Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h	(revision 23722)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h	(revision 23723)
@@ -6,5 +6,5 @@
 
 /*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -24,18 +24,17 @@
 #define __VBoxConsoleWnd_h__
 
+/* Global includes */
+#include <QColor>
+#include <QDialog>
+#include <QMainWindow>
+#include <QMap>
+#include <QMenu>
+#include <QPointer>
+
+/* Local includes */
 #include "COMDefs.h"
-
 #include "QIWithRetranslateUI.h"
-
 #include "VBoxProblemReporter.h"
 #include "VBoxHelpActions.h"
-
-/* Qt includes */
-#include <QMainWindow>
-#include <QMap>
-#include <QColor>
-#include <QDialog>
-#include <QMenu>
-#include <QPointer>
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
@@ -49,4 +48,5 @@
 #endif
 
+/* Global forwards */
 class QAction;
 class QActionGroup;
@@ -54,20 +54,14 @@
 class QSpacerItem;
 
+/* Local forwards */
+class QIMenu;
+class QIStateIndicator;
+class VBoxChangeDockIconUpdateEvent;
 class VBoxConsoleView;
-class QIStateIndicator;
-
+class VBoxMiniToolBar;
+class VBoxSwitchMenu;
 class VBoxUSBMenu;
-class VBoxSwitchMenu;
-
-class VBoxChangeDockIconUpdateEvent;
-
-class VBoxMiniToolBar;
-
-/* We want to make the first action highlighted but not
- * selected, but Qt makes the both or neither one of this,
- * so, just move the focus to the next eligible object,
- * which will be the first menu action. This little
- * subclass made only for that purpose. */
-class QIMenu : public QMenu
+
+class VBoxConsoleWnd : public QIWithRetranslateUI2 <QMainWindow>
 {
     Q_OBJECT;
@@ -75,23 +69,6 @@
 public:
 
-    QIMenu (QWidget *aParent) : QMenu (aParent) {}
-
-    void selectFirstAction() { QMenu::focusNextChild(); }
-};
-
-class VBoxConsoleWnd : public QIWithRetranslateUI2<QMainWindow>
-{
-    Q_OBJECT;
-
-public:
-
-    VBoxConsoleWnd (VBoxConsoleWnd **aSelf,
-                     QWidget* aParent = 0,
-                     Qt::WindowFlags aFlags = Qt::Window);
+    VBoxConsoleWnd (VBoxConsoleWnd **aSelf, QWidget* aParent = 0, Qt::WindowFlags aFlags = Qt::Window);
     virtual ~VBoxConsoleWnd();
-
-    bool openView (const CSession &session);
-
-    void refreshView();
 
     bool isWindowMaximized() const
@@ -101,5 +78,5 @@
          * maximize the window. This situation has to be considered when
          * checking for maximized or fullscreen mode. */
-        return !(isTrueSeamless()) && QMainWindow::isMaximized();
+        return !isTrueSeamless() && QMainWindow::isMaximized();
 #else /* Q_WS_MAC */
         return QMainWindow::isMaximized();
@@ -117,9 +94,11 @@
 #endif /* Q_WS_MAC */
     }
-
     bool isTrueFullscreen() const { return mIsFullscreen; }
-
     bool isTrueSeamless() const { return mIsSeamless; }
 
+    KMachineState machineState() const { return mMachineState; }
+
+    bool openView (const CSession &aSession);
+
     void setMouseIntegrationLocked (bool aDisabled);
 
@@ -129,13 +108,6 @@
 
     void setMask (const QRegion &aRegion);
-
     void clearMask();
 
-    KMachineState machineState() const { return machine_state; }
-
-public slots:
-
-    void changeDockIconUpdate (const VBoxChangeDockIconUpdateEvent &e);
-
 signals:
 
@@ -144,22 +116,73 @@
 protected:
 
-    // events
-    bool event (QEvent *e);
-    void closeEvent (QCloseEvent *e);
-#if defined(Q_WS_X11)
-    bool x11Event (XEvent *event);
+    bool event (QEvent *aEvent);
+    void closeEvent (QCloseEvent *aEvent);
+#ifdef Q_WS_X11
+    bool x11Event (XEvent *aEvent);
 #endif
 
     void retranslateUi();
 
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    bool dbgCreated();
-    void dbgDestroy();
-    void dbgAdjustRelativePos();
-#endif
-
-protected slots:
-
-    void closeView();
+private slots:
+
+    void finalizeOpenView();
+    void tryClose();
+
+    void vmFullscreen (bool aOn);
+    void vmSeamless (bool aOn);
+    void vmAutoresizeGuest (bool aOn);
+    void vmAdjustWindow();
+    void vmDisableMouseIntegration (bool aOff);
+    void vmTypeCAD();
+#ifdef Q_WS_X11
+    void vmTypeCABS();
+#endif
+    void vmTakeSnapshot();
+    void vmShowInfoDialog();
+    void vmReset();
+    void vmPause (bool aOn);
+    void vmACPIShutdown();
+    void vmClose();
+
+    void devicesSwitchVrdp (bool aOn);
+    void devicesOpenStorageDialog();
+    void devicesOpenNetworkDialog();
+    void devicesOpenSFDialog();
+    void devicesInstallGuestAdditions();
+
+    void prepareStorageMenu();
+    void prepareNetworkMenu();
+    void prepareSFMenu();
+
+    void switchUSB (QAction *aAction);
+
+    void showIndicatorContextMenu (QIStateIndicator *aInd, QContextMenuEvent *aEvent);
+
+    void updateDeviceLights();
+    void updateMachineState (KMachineState aState);
+    void updateMouseState (int aState);
+    void updateAdditionsState (const QString &aVersion, bool aActive,
+                               bool aSeamlessSupported, bool aGraphicsSupported);
+    void updateNetworkAdaptersState();
+    void updateUsbState();
+    void updateMediaDriveState (VBoxDefs::MediumType aType);
+    void updateSharedFoldersState();
+
+    void onExitFullscreen();
+    void unlockActionsSwitch();
+
+    void mtExitMode();
+    void mtCloseVM();
+    void mtMaskUpdate();
+
+    void changeDockIconUpdate (const VBoxChangeDockIconUpdateEvent &aEvent);
+    void processGlobalSettingChange (const char *aPublicName, const char *aName);
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    void dbgPrepareDebugMenu();
+    void dbgShowStatistics();
+    void dbgShowCommandLine();
+    void dbgLoggingToggled (bool aBool);
+#endif
 
 private:
@@ -167,7 +190,7 @@
     enum /* Stuff */
     {
-        FloppyStuff                 = 0x01,
+        HardDiskStuff               = 0x01,
         DVDStuff                    = 0x02,
-        HardDiskStuff               = 0x04,
+        FloppyStuff                 = 0x04,
         PauseAction                 = 0x08,
         NetworkStuff                = 0x10,
@@ -181,86 +204,49 @@
     };
 
-    void updateAppearanceOf (int element);
-
-    bool toggleFullscreenMode (bool, bool);
-
     void checkRequiredFeatures();
-
-private slots:
-
-    void finalizeOpenView();
-
     void activateUICustomizations();
 
-    void vmFullscreen (bool on);
-    void vmSeamless (bool on);
-    void vmAutoresizeGuest (bool on);
-    void vmAdjustWindow();
-
-    void vmTypeCAD();
-    void vmTypeCABS();
-    void vmReset();
-    void vmPause(bool);
-    void vmACPIShutdown();
-    void vmClose();
-    void vmTakeSnapshot();
-    void vmShowInfoDialog();
-    void vmDisableMouseIntegr (bool);
-
-    void devicesMountFloppyImage();
-    void devicesUnmountFloppy();
-    void devicesMountDVDImage();
-    void devicesUnmountDVD();
-    void devicesSwitchVrdp (bool);
-    void devicesOpenNetworkDialog();
-    void devicesOpenSFDialog();
-    void devicesInstallGuestAdditions();
-
-    void prepareFloppyMenu();
-    void prepareDVDMenu();
-    void prepareNetworkMenu();
-    void prepareSFMenu();
-
-    void captureFloppy (QAction *aAction);
-    void captureDVD (QAction *aAction);
-    void switchUSB (QAction *aAction);
-
-    void statusTipChanged (const QString &);
-    void clearStatusBar();
-
-    void showIndicatorContextMenu (QIStateIndicator *ind, QContextMenuEvent *e);
-
-    void updateDeviceLights();
-    void updateMachineState (KMachineState state);
-    void updateMouseState (int state);
-    void updateAdditionsState (const QString&, bool, bool, bool);
-    void updateNetworkAdaptersState();
-    void updateUsbState();
-    void updateMediaDriveState (VBoxDefs::MediumType aType);
-    void updateSharedFoldersState();
-
-    void tryClose();
-
-    void processGlobalSettingChange (const char *publicName, const char *name);
-
-    void dbgPrepareDebugMenu();
-    void dbgShowStatistics();
-    void dbgShowCommandLine();
-    void dbgLoggingToggled(bool aBool);
-
-    void onExitFullscreen();
-    void unlockActionsSwitch();
-
+    void updateAppearanceOf (int aElement);
+
+    bool toggleFullscreenMode (bool aOn, bool aSeamless);
     void switchToFullscreen (bool aOn, bool aSeamless);
     void setViewInSeamlessMode (const QRect &aTargetRect);
 
-    void mtExitMode();
-    void mtCloseVM();
-    void mtMaskUpdate();
-
-private:
-
-    /** Popup version of the main menu */
+    void closeView();
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    bool dbgCreated();
+    void dbgDestroy();
+    void dbgAdjustRelativePos();
+#endif
+
+    /* COM Variables */
+    CSession mSession;
+
+    /* Machine State */
+    KMachineState mMachineState;
+
+    /* Window Variables */
+    QString mCaptionPrefix;
+    int mConsoleStyle;
+
+    /* Menu items */
     QIMenu *mMainMenu;
+    QMenu *mVMMenu;
+    QMenu *mVMMenuMini;
+    QMenu *mDevicesMenu;
+    QMenu *mDevicesStorageMenu;
+    QMenu *mDevicesNetworkMenu;
+    QMenu *mDevicesSFMenu;
+    VBoxUSBMenu *mDevicesUSBMenu;
+    VBoxSwitchMenu *mVmDisMouseIntegrMenu;
+#if 0 /* todo: allow to setup */
+    VBoxSwitchMenu *mDevicesVRDPMenu;
+    VBoxSwitchMenu *mVmAutoresizeMenu;
+#endif
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    QMenu *mDbgMenu;
+#endif
+    QMenu *mHelpMenu;
 
     QActionGroup *mRunningActions;
@@ -272,24 +258,22 @@
     QAction *mVmAutoresizeGuestAction;
     QAction *mVmAdjustWindowAction;
+    QAction *mVmDisableMouseIntegrAction;
     QAction *mVmTypeCADAction;
-#if defined(Q_WS_X11)
+#ifdef Q_WS_X11
     QAction *mVmTypeCABSAction;
 #endif
+    QAction *mVmTakeSnapshotAction;
+    QAction *mVmShowInformationDlgAction;
     QAction *mVmResetAction;
     QAction *mVmPauseAction;
     QAction *mVmACPIShutdownAction;
     QAction *mVmCloseAction;
-    QAction *mVmTakeSnapshotAction;
-    QAction *mVmDisableMouseIntegrAction;
-    QAction *mVmShowInformationDlgAction;
 
     /* Devices actions */
-    QAction *mDevicesMountFloppyImageAction;
-    QAction *mDevicesUnmountFloppyAction;
-    QAction *mDevicesMountDVDImageAction;
-    QAction *mDevicesUnmountDVDAction;
-    QAction *mDevicesSwitchVrdpAction;
+    QAction *mDevicesStorageDialogAction;
     QAction *mDevicesNetworkDialogAction;
     QAction *mDevicesSFDialogAction;
+    QAction *mDevicesSwitchVrdpSeparator;
+    QAction *mDevicesSwitchVrdpAction;
     QAction *mDevicesInstallGuestToolsAction;
 
@@ -304,74 +288,69 @@
     VBoxHelpActions mHelpActions;
 
-    /* Machine popup menus */
-    VBoxSwitchMenu *mVmAutoresizeMenu;
-    VBoxSwitchMenu *mVmDisMouseIntegrMenu;
-
-    /* Devices popup menus */
-    bool mWaitForStatusBarChange : 1;
-    bool mStatusBarChangedInside : 1;
-
-    QAction *mDevicesUSBMenuSeparator;
-    QAction *mDevicesVRDPMenuSeparator;
-    QAction *mDevicesSFMenuSeparator;
-
-    QMenu *mVMMenu;
-    QMenu *mMiniVMMenu;
-    QMenu *mDevicesMenu;
-    QMenu *mDevicesMountFloppyMenu;
-    QMenu *mDevicesMountDVDMenu;
-    QMenu *mDevicesSFMenu;
-    QMenu *mDevicesNetworkMenu;
-    VBoxUSBMenu *mDevicesUSBMenu;
-    /* VBoxSwitchMenu *mDevicesVRDPMenu; */
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    // Debugger popup menu
-    QMenu *mDbgMenu;
-#endif
-    QMenu *mHelpMenu;
-
+    /* Widgets */
+    VBoxConsoleView *mConsole;
+    VBoxMiniToolBar *mMiniToolBar;
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /** The handle to the debugger gui. */
+    PDBGGUI mDbgGui;
+    /** The virtual method table for the debugger GUI. */
+    PCDBGGUIVT mDbgGuiVT;
+#endif
+
+    /* Timer to update LEDs */
+    QTimer *mIdleTimer;
+
+    /* LEDs */
+    QIStateIndicator *mHDLed;
+    QIStateIndicator *mCDLed;
+#if 0 /* todo: allow to setup */
+    QIStateIndicator *mFDLed;
+#endif
+    QIStateIndicator *mNetLed;
+    QIStateIndicator *mUSBLed;
+    QIStateIndicator *mSFLed;
+    QIStateIndicator *mVirtLed;
+    QIStateIndicator *mMouseLed;
+    QIStateIndicator *mHostkeyLed;
+    QWidget *mHostkeyLedContainer;
+    QLabel *mHostkeyName;
+#if 0 /* todo: allow to setup */
+    QIStateIndicator *mVrdpLed;
+    QIStateIndicator *mAutoresizeLed;
+#endif
+
+    /* Normal Mode */
+    QRect mNormalGeo;
+
+    /* Fullscreen/Seamless Mode */
+    QList < QPointer <QWidget> > mHiddenChildren;
     QSpacerItem *mShiftingSpacerLeft;
     QSpacerItem *mShiftingSpacerTop;
     QSpacerItem *mShiftingSpacerRight;
     QSpacerItem *mShiftingSpacerBottom;
+    QPalette mErasePalette;
+    QSize mPrevMinSize;
     QSize mMaskShift;
-
-    CSession csession;
-
-    // widgets
-    VBoxConsoleView *console;
-    QIStateIndicator *hd_light, *cd_light, *fd_light, *net_light, *usb_light, *sf_light;
-    QIStateIndicator *mVirtLed;
-    QIStateIndicator *mouse_state, *hostkey_state;
-    QIStateIndicator *autoresize_state;
-    QIStateIndicator *vrdp_state;
-    QWidget *hostkey_hbox;
-    QLabel *hostkey_name;
-
-    QTimer *idle_timer;
-    KMachineState machine_state;
-    QString caption_prefix;
-
-    bool no_auto_close : 1;
-
-    QMap <QAction *, CMedium> hostDVDMap;
-    QMap <QAction *, CMedium> hostFloppyMap;
-
-    QRect mNormalGeo;
-    QSize prev_min_size;
-
+    QRegion mStrictedRegion;
 #ifdef Q_WS_WIN
     QRegion mPrevRegion;
 #endif
-
 #ifdef Q_WS_MAC
-    QRegion mCurrRegion;
+    //QRegion mCurrRegion;
 # ifndef QT_MAC_USE_COCOA
-    EventHandlerRef mDarwinRegionEventHandlerRef;
+    //EventHandlerRef mDarwinRegionEventHandlerRef;
 # endif
-#endif
-
-    // variables for dealing with true fullscreen
-    QRegion mStrictedRegion;
+    /* For seamless maximizing */
+    QRect mNormalGeometry;
+    Qt::WindowFlags mSavedFlags;
+    /* For the fade effect if the the window goes fullscreen */
+    CGDisplayFadeReservationToken mFadeToken;
+#endif
+
+    /* Different bool flags */
+    bool mIsOpenViewFinished : 1;
+    bool mIsFirstTimeStarted : 1;
+    bool mIsAutoSaveMedia : 1;
+    bool mNoAutoClose : 1;
     bool mIsFullscreen : 1;
     bool mIsSeamless : 1;
@@ -379,32 +358,50 @@
     bool mIsGraphicsSupported : 1;
     bool mIsWaitingModeResize : 1;
-    bool was_max : 1;
-    QList < QPointer <QWidget> > mHiddenChildren;
-    int console_style;
-    QPalette mErasePalette;
-
-    bool mIsOpenViewFinished : 1;
-    bool mIsFirstTimeStarted : 1;
-    bool mIsAutoSaveMedia : 1;
-
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    /** The handle to the debugger gui. */
-    PDBGGUI mDbgGui;
-    /** The virtual method table for the debugger GUI. */
-    PCDBGGUIVT mDbgGuiVT;
-#endif
-
-#ifdef Q_WS_MAC
-    /* For seamless maximizing */
-    QRect mNormalGeometry;
-    Qt::WindowFlags mSavedFlags;
-    /* For the fade effect if the the window goes fullscreen */
-    CGDisplayFadeReservationToken mFadeToken;
-#endif
-
-    VBoxMiniToolBar *mMiniToolBar;
+    bool mWasMax : 1;
 };
 
+/* We want to make the first action highlighted but not
+ * selected, but Qt makes the both or neither one of this,
+ * so, just move the focus to the next eligible object,
+ * which will be the first menu action. This little
+ * subclass made only for that purpose. */
+class QIMenu : public QMenu
+{
+    Q_OBJECT;
+
+public:
+
+    QIMenu (QWidget *aParent) : QMenu (aParent) {}
+
+    void selectFirstAction() { QMenu::focusNextChild(); }
+};
+
 class VBoxSettingsPage;
+class VBoxStorageDialog : public QIWithRetranslateUI <QDialog>
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxStorageDialog (QWidget *aParent, CSession &aSession);
+
+protected:
+
+    void retranslateUi();
+
+protected slots:
+
+    virtual void accept();
+
+protected:
+
+    void showEvent (QShowEvent *aEvent);
+
+private:
+
+    VBoxSettingsPage *mSettings;
+    CSession &mSession;
+};
+
 class VBoxNetworkDialog : public QIWithRetranslateUI <QDialog>
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h	(revision 23722)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h	(revision 23723)
@@ -504,9 +504,11 @@
 public:
 
-    StorageDelegate (QObject *aParent);
+    StorageDelegate (QObject *aParent, bool aDisableStaticControls);
 
 private:
 
     void paint (QPainter *aPainter, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const;
+
+    bool mDisableStaticControls;
 };
 
@@ -522,5 +524,5 @@
 public:
 
-    VBoxVMSettingsHD();
+    VBoxVMSettingsHD (bool aDisableStaticControls = false);
 
 signals:
@@ -608,4 +610,5 @@
     bool mIsLoadingInProgress;
     bool mIsPolished;
+    bool mDisableStaticControls;
 };
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 23722)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp	(revision 23723)
@@ -21,5 +21,26 @@
  */
 
-/* VBox includes */
+/* Global includes */
+#include <QActionGroup>
+#include <QDesktopWidget>
+#include <QDir>
+#include <QFileInfo>
+#include <QMenuBar>
+#include <QProgressBar>
+#include <QTimer>
+
+#ifdef Q_WS_X11
+# include <QX11Info>
+#endif
+#ifdef Q_WS_MAC
+# include <QPainter>
+#endif
+
+/* Local includes */
+#include "QIFileDialog.h"
+#include "QIHotKeyEdit.h"
+#include "QIHttp.h"
+#include "QIStateIndicator.h"
+#include "QIStatusBar.h"
 #include "VBoxConsoleWnd.h"
 #include "VBoxConsoleView.h"
@@ -32,40 +53,18 @@
 #include "VBoxTakeSnapshotDlg.h"
 #include "VBoxVMFirstRunWzd.h"
+#include "VBoxVMSettingsHD.h"
 #include "VBoxVMSettingsNetwork.h"
 #include "VBoxVMSettingsSF.h"
 #include "VBoxVMInformationDlg.h"
-#include "QIFileDialog.h"
-#include "QIHotKeyEdit.h"
-#include "QIHttp.h"
-#include "QIStateIndicator.h"
-#include "QIStatusBar.h"
-
-/* Qt includes */
-#include <QActionGroup>
-#include <QDesktopWidget>
-#include <QDir>
-#include <QFileInfo>
-#include <QMenuBar>
-#include <QProgressBar>
-#include <QTimer>
+
 #ifdef Q_WS_X11
-# include <QX11Info>
-#endif
-
-#include <VBox/VMMDev.h> /** @todo @bugref{4084} */
-
-#if defined(Q_WS_X11)
-#include <X11/Xlib.h>
-#include <XKeyboard.h>
-#endif
-
+# include <X11/Xlib.h>
+# include <XKeyboard.h>
+#endif
 #ifdef Q_WS_MAC
 # include "VBoxUtils.h"
 # include "VBoxIChatTheaterWrapper.h"
 # include <ApplicationServices/ApplicationServices.h>
-  /* Qt includes */
-# include <QPainter>
-#endif
-
+#endif
 #ifdef VBOX_WITH_DEBUGGER_GUI
 # include <VBox/err.h>
@@ -73,7 +72,11 @@
 #endif
 
+#include <VBox/VMMDev.h> /** @todo @bugref{4084} */
 #include <iprt/buildconfig.h>
 #include <iprt/param.h>
 #include <iprt/path.h>
+
+/* Global forwards */
+extern void qt_set_sequence_auto_mnemonic (bool on);
 
 /** class StatusTipEvent
@@ -94,9 +97,4 @@
     QString mTip;
 };
-
-#ifdef RT_OS_DARWIN
-class Q3Http;
-class Q3HttpResponseHeader;
-#endif
 
 class VBoxAdditionsDownloader : public VBoxDownloaderWgt
@@ -215,18 +213,91 @@
  *               recursion in VBoxGlobal::consoleWnd())
  */
-VBoxConsoleWnd::
-VBoxConsoleWnd (VBoxConsoleWnd **aSelf, QWidget* aParent,
-                Qt::WindowFlags aFlags /* = Qt::Window */)
-    : QIWithRetranslateUI2<QMainWindow> (aParent, aFlags)
+VBoxConsoleWnd::VBoxConsoleWnd (VBoxConsoleWnd **aSelf, QWidget* aParent, Qt::WindowFlags aFlags /* = Qt::Window */)
+    : QIWithRetranslateUI2 <QMainWindow> (aParent, aFlags)
+    /* Machine State */
+    , mMachineState (KMachineState_Null)
+    /* Window Variables */
+    , mConsoleStyle (0)
+    /* Menu Items */
     , mMainMenu (0)
+    , mVMMenu (0)
+    , mVMMenuMini (0)
+    , mDevicesMenu (0)
+    , mDevicesStorageMenu (0)
+    , mDevicesNetworkMenu (0)
+    , mDevicesSFMenu (0)
+    , mDevicesUSBMenu (0)
+    , mVmDisMouseIntegrMenu (0)
+#if 0 /* TODO: Allow to setup status-bar! */
+    , mDevicesVRDPMenu (0)
+    , mVmAutoresizeMenu (0)
+#endif
 #ifdef VBOX_WITH_DEBUGGER_GUI
-    , mDbgStatisticsAction (NULL)
-    , mDbgCommandLineAction (NULL)
-    , mDbgLoggingAction (NULL)
-    , mDbgMenu (NULL)
-#endif
-    , console (0)
-    , machine_state (KMachineState_Null)
-    , no_auto_close (false)
+    , mDbgMenu (0)
+#endif
+    , mHelpMenu (0)
+    /* Action Groups */
+    , mRunningActions (0)
+    , mRunningOrPausedActions (0)
+    /* Machine Menu Actions */
+    , mVmFullscreenAction (0)
+    , mVmSeamlessAction (0)
+    , mVmAutoresizeGuestAction (0)
+    , mVmAdjustWindowAction (0)
+    , mVmDisableMouseIntegrAction (0)
+    , mVmTypeCADAction (0)
+#ifdef Q_WS_X11
+    , mVmTypeCABSAction (0)
+#endif
+    , mVmTakeSnapshotAction (0)
+    , mVmShowInformationDlgAction (0)
+    , mVmResetAction (0)
+    , mVmPauseAction (0)
+    , mVmACPIShutdownAction (0)
+    , mVmCloseAction (0)
+    /* Device Menu Actions */
+    , mDevicesStorageDialogAction (0)
+    , mDevicesNetworkDialogAction (0)
+    , mDevicesSFDialogAction (0)
+    , mDevicesSwitchVrdpSeparator (0)
+    , mDevicesSwitchVrdpAction (0)
+    , mDevicesInstallGuestToolsAction (0)
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /* Debug Menu Actions */
+    , mDbgStatisticsAction (0)
+    , mDbgCommandLineAction (0)
+    , mDbgLoggingAction (0)
+#endif
+    /* Widgets */
+    , mConsole (0)
+    , mMiniToolBar (0)
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    , mDbgGui (0)
+    , mDbgGuiVT (0)
+#endif
+    /* LED Update Timer */
+    , mIdleTimer (new QTimer (this))
+    /* LEDs */
+    , mHDLed (0)
+    , mCDLed (0)
+#if 0 /* TODO: Allow to setup status-bar! */
+    , mFDLed (0)
+#endif
+    , mNetLed (0)
+    , mUSBLed (0)
+    , mSFLed (0)
+    , mVirtLed (0)
+    , mMouseLed (0)
+    , mHostkeyLed (0)
+    , mHostkeyLedContainer (0)
+    , mHostkeyName (0)
+#if 0 /* TODO: Allow to setup status-bar! */
+    , mVrdpLed (0)
+    , mAutoresizeLed (0)
+#endif
+    , mIsOpenViewFinished (false)
+    , mIsFirstTimeStarted (false)
+    , mIsAutoSaveMedia (true)
+    , mNoAutoClose (false)
     , mIsFullscreen (false)
     , mIsSeamless (false)
@@ -234,18 +305,11 @@
     , mIsGraphicsSupported (false)
     , mIsWaitingModeResize (false)
-    , was_max (false)
-    , console_style (0)
-    , mIsOpenViewFinished (false)
-    , mIsFirstTimeStarted (false)
-    , mIsAutoSaveMedia (true)
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    , mDbgGui (NULL)
-    , mDbgGuiVT (NULL)
-#endif
+    , mWasMax (false)
 {
     if (aSelf)
         *aSelf = this;
 
-    idle_timer = new QTimer (this);
+    /* Enumerate mediums to work with cached data */
+    vboxGlobal().startEnumeratingMedia();
 
 #if !(defined (Q_WS_WIN) || defined (Q_WS_MAC))
@@ -256,10 +320,8 @@
 #endif
 
-    /* ensure status bar is created */
+    /* Ensure status bar is created */
     setStatusBar (new QIStatusBar (this));
 
-    ///// Actions ///////////////////////////////////////////////////////////
-
-    /* a group for all actions that are enabled only when the VM is running.
+    /* A group for all actions that are enabled only when the VM is running.
      * Note that only actions whose enabled state depends exclusively on the
      * execution state of the VM are added to this group. */
@@ -267,5 +329,5 @@
     mRunningActions->setExclusive (false);
 
-    /* a group for all actions that are enabled when the VM is running or
+    /* A group for all actions that are enabled when the VM is running or
      * paused. Note that only actions whose enabled state depends exclusively
      * on the execution state of the VM are added to this group. */
@@ -274,61 +336,63 @@
 
     /* VM menu actions */
-
     mVmFullscreenAction = new QAction (this);
-    mVmFullscreenAction->setIcon (
-        VBoxGlobal::iconSetOnOff (
-            ":/fullscreen_on_16px.png", ":/fullscreen_16px.png",
-            ":/fullscreen_on_disabled_16px.png", ":/fullscreen_disabled_16px.png"));
+    mVmFullscreenAction->setIcon (VBoxGlobal::iconSetOnOff (
+        ":/fullscreen_on_16px.png", ":/fullscreen_16px.png",
+        ":/fullscreen_on_disabled_16px.png", ":/fullscreen_disabled_16px.png"));
     mVmFullscreenAction->setCheckable (true);
 
     mVmSeamlessAction = new QAction (this);
-    mVmSeamlessAction->setIcon (
-        VBoxGlobal::iconSetOnOff (
-            ":/seamless_on_16px.png", ":/seamless_16px.png",
-            ":/seamless_on_disabled_16px.png", ":/seamless_disabled_16px.png"));
+    mVmSeamlessAction->setIcon (VBoxGlobal::iconSetOnOff (
+        ":/seamless_on_16px.png", ":/seamless_16px.png",
+        ":/seamless_on_disabled_16px.png", ":/seamless_disabled_16px.png"));
     mVmSeamlessAction->setCheckable (true);
 
     mVmAutoresizeGuestAction = new QAction (mRunningActions);
-    mVmAutoresizeGuestAction->setIcon (
-        VBoxGlobal::iconSetOnOff (
-            ":/auto_resize_on_on_16px.png", ":/auto_resize_on_16px.png",
-            ":/auto_resize_on_on_disabled_16px.png", ":/auto_resize_on_disabled_16px.png"));
+    mVmAutoresizeGuestAction->setIcon (VBoxGlobal::iconSetOnOff (
+        ":/auto_resize_on_on_16px.png", ":/auto_resize_on_16px.png",
+        ":/auto_resize_on_on_disabled_16px.png", ":/auto_resize_on_disabled_16px.png"));
     mVmAutoresizeGuestAction->setCheckable (true);
     mVmAutoresizeGuestAction->setEnabled (false);
 
     mVmAdjustWindowAction = new QAction (this);
-    mVmAdjustWindowAction->setIcon (
-        VBoxGlobal::iconSet (":/adjust_win_size_16px.png",
-                             ":/adjust_win_size_disabled_16px.png"));
+    mVmAdjustWindowAction->setIcon (VBoxGlobal::iconSet (
+        ":/adjust_win_size_16px.png", ":/adjust_win_size_disabled_16px.png"));
+
+    mVmDisableMouseIntegrAction = new QAction (this);
+    mVmDisableMouseIntegrAction->setIcon (VBoxGlobal::iconSetOnOff (
+        ":/mouse_can_seamless_on_16px.png", ":/mouse_can_seamless_16px.png",
+        ":/mouse_can_seamless_on_disabled_16px.png", ":/mouse_can_seamless_disabled_16px.png"));
+    mVmDisableMouseIntegrAction->setCheckable (true);
 
     mVmTypeCADAction = new QAction (mRunningActions);
-    mVmTypeCADAction->setIcon (VBoxGlobal::iconSet (":/hostkey_16px.png",
-                                                      ":/hostkey_disabled_16px.png"));
+    mVmTypeCADAction->setIcon (VBoxGlobal::iconSet (
+        ":/hostkey_16px.png", ":/hostkey_disabled_16px.png"));
 
 #if defined(Q_WS_X11)
     mVmTypeCABSAction = new QAction (mRunningActions);
-    mVmTypeCABSAction->setIcon (VBoxGlobal::iconSet (":/hostkey_16px.png",
-                                                       ":/hostkey_disabled_16px.png"));
-#endif
+    mVmTypeCABSAction->setIcon (VBoxGlobal::iconSet (
+        ":/hostkey_16px.png", ":/hostkey_disabled_16px.png"));
+#endif
+
+    mVmTakeSnapshotAction = new QAction (mRunningOrPausedActions);
+    mVmTakeSnapshotAction->setIcon (VBoxGlobal::iconSet (
+        ":/take_snapshot_16px.png", ":/take_snapshot_dis_16px.png"));
+
+    mVmShowInformationDlgAction = new QAction (this);
+    mVmShowInformationDlgAction->setIcon (VBoxGlobal::iconSet (
+        ":/session_info_16px.png", ":/session_info_disabled_16px.png"));
 
     mVmResetAction = new QAction (mRunningActions);
-    mVmResetAction->setIcon (VBoxGlobal::iconSet (":/reset_16px.png",
-                                                    ":/reset_disabled_16px.png"));
+    mVmResetAction->setIcon (VBoxGlobal::iconSet (
+        ":/reset_16px.png", ":/reset_disabled_16px.png"));
 
     mVmPauseAction = new QAction (this);
-    mVmPauseAction->setIcon (
-        /* checkbox over the pause icon doesn't look nice */
-#if 0
-        VBoxGlobal::iconSetOnOff (
-            ":/pause_on_16px.png", ":/pause_16px.png",
-            ":/pause_on_disabled_16px.png", ":/pause_disabled_16px.png"));
-#else
-        VBoxGlobal::iconSet (":/pause_16px.png", ":/pause_disabled_16px.png"));
-#endif
+    mVmPauseAction->setIcon (VBoxGlobal::iconSet (
+        ":/pause_16px.png", ":/pause_disabled_16px.png"));
     mVmPauseAction->setCheckable (true);
 
     mVmACPIShutdownAction = new QAction (mRunningActions);
-    mVmACPIShutdownAction->setIcon (
-        VBoxGlobal::iconSet (":/acpi_16px.png", ":/acpi_disabled_16px.png"));
+    mVmACPIShutdownAction->setIcon (VBoxGlobal::iconSet (
+        ":/acpi_16px.png", ":/acpi_disabled_16px.png"));
 
     mVmCloseAction = new QAction (this);
@@ -336,58 +400,29 @@
     mVmCloseAction->setIcon (VBoxGlobal::iconSet (":/exit_16px.png"));
 
-    mVmTakeSnapshotAction = new QAction (mRunningOrPausedActions);
-    mVmTakeSnapshotAction->setIcon (VBoxGlobal::iconSet (
-        ":/take_snapshot_16px.png", ":/take_snapshot_dis_16px.png"));
-
-    mVmShowInformationDlgAction = new QAction (this);
-    mVmShowInformationDlgAction->setIcon (VBoxGlobal::iconSet (
-        ":/session_info_16px.png", ":/session_info_disabled_16px.png"));
-
-    mVmDisableMouseIntegrAction = new QAction (this);
-    mVmDisableMouseIntegrAction->setIcon (
-        VBoxGlobal::iconSetOnOff (
-            ":/mouse_can_seamless_on_16px.png", ":/mouse_can_seamless_16px.png",
-            ":/mouse_can_seamless_on_disabled_16px.png", ":/mouse_can_seamless_disabled_16px.png"));
-    mVmDisableMouseIntegrAction->setCheckable (true);
-
     /* Devices menu actions */
-
-    mDevicesMountFloppyImageAction = new QAction (mRunningOrPausedActions);
-
-    mDevicesUnmountFloppyAction = new QAction (this);
-    mDevicesUnmountFloppyAction->setIcon (
-        VBoxGlobal::iconSet (":/fd_unmount_16px.png",
-                             ":/fd_unmount_dis_16px.png"));
-
-    mDevicesMountDVDImageAction = new QAction (mRunningOrPausedActions);
-
-    mDevicesUnmountDVDAction = new QAction (this);
-    mDevicesUnmountDVDAction->setIcon (
-        VBoxGlobal::iconSet (":/cd_unmount_16px.png",
-                             ":/cd_unmount_dis_16px.png"));
+    mDevicesStorageDialogAction = new QAction (mRunningOrPausedActions);
+    mDevicesStorageDialogAction->setIcon (VBoxGlobal::iconSet (
+        ":/attachment_16px.png", ":/attachment_disabled_16px.png"));
 
     mDevicesNetworkDialogAction = new QAction (mRunningOrPausedActions);
-    mDevicesNetworkDialogAction->setIcon (
-        VBoxGlobal::iconSet (":/nw_16px.png",
-                             ":/nw_disabled_16px.png"));
+    mDevicesNetworkDialogAction->setIcon (VBoxGlobal::iconSet (
+        ":/nw_16px.png", ":/nw_disabled_16px.png"));
 
     mDevicesSFDialogAction = new QAction (mRunningOrPausedActions);
-    mDevicesSFDialogAction->setIcon (
-        VBoxGlobal::iconSet (":/shared_folder_16px.png",
-                             ":/shared_folder_disabled_16px.png"));
+    mDevicesSFDialogAction->setIcon (VBoxGlobal::iconSet (
+        ":/shared_folder_16px.png", ":/shared_folder_disabled_16px.png"));
 
     mDevicesSwitchVrdpAction = new QAction (mRunningOrPausedActions);
-    mDevicesSwitchVrdpAction->setIcon (
-        VBoxGlobal::iconSetOnOff (
-            ":/vrdp_on_16px.png", ":/vrdp_16px.png",
-            ":/vrdp_on_disabled_16px.png", ":/vrdp_disabled_16px.png"));
+    mDevicesSwitchVrdpAction->setIcon (VBoxGlobal::iconSetOnOff (
+        ":/vrdp_on_16px.png", ":/vrdp_16px.png",
+        ":/vrdp_on_disabled_16px.png", ":/vrdp_disabled_16px.png"));
     mDevicesSwitchVrdpAction->setCheckable (true);
 
     mDevicesInstallGuestToolsAction = new QAction (mRunningActions);
-    mDevicesInstallGuestToolsAction->setIcon (
-        VBoxGlobal::iconSet (":/guesttools_16px.png",
-                             ":/guesttools_disabled_16px.png"));
+    mDevicesInstallGuestToolsAction->setIcon (VBoxGlobal::iconSet (
+        ":/guesttools_16px.png", ":/guesttools_disabled_16px.png"));
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
+    /* Debug menu actions */
     if (vboxGlobal().isDebuggerEnabled())
     {
@@ -404,29 +439,26 @@
     else
     {
-        mDbgStatisticsAction = NULL;
-        mDbgCommandLineAction = NULL;
-        mDbgLoggingAction = NULL;
+        mDbgStatisticsAction = 0;
+        mDbgCommandLineAction = 0;
+        mDbgLoggingAction = 0;
     }
 #endif
 
     /* Help menu actions */
-
     mHelpActions.setup (this);
 
-    ///// Menubar ///////////////////////////////////////////////////////////
-
+    /* Menu Items */
     mMainMenu = new QIMenu (this);
-    mDevicesNetworkMenu = new QMenu(this);
-    mDevicesSFMenu = new QMenu(this);
+    mDevicesStorageMenu = new QMenu (this);
+    mDevicesNetworkMenu = new QMenu (this);
+    mDevicesSFMenu = new QMenu (this);
 
     /* Machine submenu */
-
     mVMMenu = menuBar()->addMenu (QString::null);
     mMainMenu->addMenu (mVMMenu);
-
-    /* dynamic & status line popup menus */
+    mVmDisMouseIntegrMenu = new VBoxSwitchMenu (mVMMenu, mVmDisableMouseIntegrAction, true);
+#if 0 /* TODO: Allow to setup status-bar! */
     mVmAutoresizeMenu = new VBoxSwitchMenu (mVMMenu, mVmAutoresizeGuestAction);
-    mVmDisMouseIntegrMenu = new VBoxSwitchMenu (mVMMenu, mVmDisableMouseIntegrAction,
-                                               true /* inverted toggle state */);
+#endif
 
     mVMMenu->addAction (mVmFullscreenAction);
@@ -438,5 +470,5 @@
     mVMMenu->addSeparator();
     mVMMenu->addAction (mVmTypeCADAction);
-#if defined(Q_WS_X11)
+#ifdef Q_WS_X11
     mVMMenu->addAction (mVmTypeCABSAction);
 #endif
@@ -455,43 +487,30 @@
 
     /* Devices submenu */
-
     mDevicesMenu = menuBar()->addMenu (QString::null);
     mMainMenu->addMenu (mDevicesMenu);
 
-    /* dynamic & statusline popup menus */
-
-    mDevicesMountDVDMenu = mDevicesMenu->addMenu (VBoxGlobal::iconSet (":/cd_16px.png", ":/cd_disabled_16px.png"), QString::null);
-    mDevicesMenu->addAction (mDevicesUnmountDVDAction);
+    mDevicesUSBMenu = new VBoxUSBMenu (mDevicesMenu);
+    mDevicesUSBMenu->setIcon (VBoxGlobal::iconSet (
+        ":/usb_16px.png", ":/usb_disabled_16px.png"));
+
+    mDevicesMenu->addAction (mDevicesStorageDialogAction);
+    mDevicesMenu->addAction (mDevicesNetworkDialogAction);
+    mDevicesMenu->addAction (mDevicesSFDialogAction);
+    mDevicesMenu->addMenu (mDevicesUSBMenu);
+
+#if 0 /* TODO: Allow to setup status-bar! */
+    mDevicesVRDPMenu = new VBoxSwitchMenu (mDevicesMenu, mDevicesSwitchVrdpAction);
+#endif
+    mDevicesSwitchVrdpSeparator = mDevicesMenu->addSeparator();
+    mDevicesMenu->addAction (mDevicesSwitchVrdpAction);
+
     mDevicesMenu->addSeparator();
-
-    mDevicesMountFloppyMenu = mDevicesMenu->addMenu (VBoxGlobal::iconSet (":/fd_16px.png", ":/fd_disabled_16px.png"), QString::null);
-    mDevicesMenu->addAction (mDevicesUnmountFloppyAction);
-    mDevicesMenu->addSeparator();
-
-    mDevicesMenu->addAction (mDevicesNetworkDialogAction);
-    mDevicesMenu->addSeparator();
-
-    mDevicesUSBMenu = new VBoxUSBMenu (mDevicesMenu);
-    mDevicesMenu->addMenu (mDevicesUSBMenu);
-    mDevicesUSBMenu->setIcon (VBoxGlobal::iconSet (":/usb_16px.png", ":/usb_disabled_16px.png"));
-    mDevicesUSBMenuSeparator = mDevicesMenu->addSeparator();
-
-    mDevicesMenu->addAction (mDevicesSFDialogAction);
-    mDevicesSFMenuSeparator = mDevicesMenu->addSeparator();
-
-    /* Currently not needed cause there is no state icon in the statusbar */
-    /* mDevicesVRDPMenu = new VBoxSwitchMenu (mDevicesMenu, mDevicesSwitchVrdpAction); */
-    mDevicesMenu->addAction (mDevicesSwitchVrdpAction);
-    mDevicesVRDPMenuSeparator = mDevicesMenu->addSeparator();
-
     mDevicesMenu->addAction (mDevicesInstallGuestToolsAction);
 
-    /* reset the "context menu" flag */
-    mDevicesMountFloppyMenu->menuAction()->setData (false);
-    mDevicesMountDVDMenu->menuAction()->setData (false);
+    /* Reset the "context menu" flag */
     mDevicesUSBMenu->menuAction()->setData (false);
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
-    /* Debug popup menu */
+    /* Debug submenu */
     if (vboxGlobal().isDebuggerEnabled())
     {
@@ -503,73 +522,72 @@
     }
     else
-        mDbgMenu = NULL;
+        mDbgMenu = 0;
 #endif
 
     /* Help submenu */
-
     mHelpMenu = menuBar()->addMenu (QString::null);
     mMainMenu->addMenu (mHelpMenu);
-
     mHelpActions.addTo (mHelpMenu);
 
-    /* Machine submenu for mini toolbar */
-    mMiniVMMenu = new QMenu (this);
-    mMiniVMMenu->addAction (mVmTypeCADAction);
+    /* Machine submenu for mini-toolbar */
+    mVMMenuMini = new QMenu (this);
+    mVMMenuMini->addAction (mVmTypeCADAction);
 #ifdef Q_WS_X11
-    mMiniVMMenu->addAction (mVmTypeCABSAction);
-#endif
-    mMiniVMMenu->addSeparator();
-    mMiniVMMenu->addAction (mVmTakeSnapshotAction);
-    mMiniVMMenu->addSeparator();
-    mMiniVMMenu->addAction (mVmShowInformationDlgAction);
-    mMiniVMMenu->addSeparator();
-    mMiniVMMenu->addAction (mVmResetAction);
-    mMiniVMMenu->addAction (mVmPauseAction);
-    mMiniVMMenu->addAction (mVmACPIShutdownAction);
-
-    ///// Status bar ////////////////////////////////////////////////////////
-
-    QWidget *indicatorBox = new QWidget ();
+    mVMMenuMini->addAction (mVmTypeCABSAction);
+#endif
+    mVMMenuMini->addSeparator();
+    mVMMenuMini->addAction (mVmTakeSnapshotAction);
+    mVMMenuMini->addSeparator();
+    mVMMenuMini->addAction (mVmShowInformationDlgAction);
+    mVMMenuMini->addSeparator();
+    mVMMenuMini->addAction (mVmResetAction);
+    mVMMenuMini->addAction (mVmPauseAction);
+    mVMMenuMini->addAction (mVmACPIShutdownAction);
+
+    /* Status bar */
+    QWidget *indicatorBox = new QWidget;
     QHBoxLayout *indicatorBoxHLayout = new QHBoxLayout (indicatorBox);
     VBoxGlobal::setLayoutMargin (indicatorBoxHLayout, 0);
     indicatorBoxHLayout->setSpacing (5);
+
     /* i/o devices */
-    hd_light = new QIStateIndicator (KDeviceActivity_Idle);
-    hd_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/hd_16px.png"));
-    hd_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/hd_read_16px.png"));
-    hd_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/hd_write_16px.png"));
-    hd_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/hd_disabled_16px.png"));
-    indicatorBoxHLayout->addWidget (hd_light);
-    cd_light = new QIStateIndicator (KDeviceActivity_Idle);
-    cd_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/cd_16px.png"));
-    cd_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/cd_read_16px.png"));
-    cd_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/cd_write_16px.png"));
-    cd_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/cd_disabled_16px.png"));
-    indicatorBoxHLayout->addWidget (cd_light);
-    fd_light = new QIStateIndicator (KDeviceActivity_Idle);
-    fd_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/fd_16px.png"));
-    fd_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/fd_read_16px.png"));
-    fd_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/fd_write_16px.png"));
-    fd_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/fd_disabled_16px.png"));
-    fd_light->hide(); /* This LED hidden due to little importance (defect #3630) */
-    indicatorBoxHLayout->addWidget (fd_light);
-    net_light = new QIStateIndicator (KDeviceActivity_Idle);
-    net_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/nw_16px.png"));
-    net_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/nw_read_16px.png"));
-    net_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/nw_write_16px.png"));
-    net_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/nw_disabled_16px.png"));
-    indicatorBoxHLayout->addWidget (net_light);
-    usb_light = new QIStateIndicator (KDeviceActivity_Idle);
-    usb_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/usb_16px.png"));
-    usb_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/usb_read_16px.png"));
-    usb_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/usb_write_16px.png"));
-    usb_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/usb_disabled_16px.png"));
-    indicatorBoxHLayout->addWidget (usb_light);
-    sf_light = new QIStateIndicator (KDeviceActivity_Idle);
-    sf_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/shared_folder_16px.png"));
-    sf_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/shared_folder_read_16px.png"));
-    sf_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/shared_folder_write_16px.png"));
-    sf_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/shared_folder_disabled_16px.png"));
-    indicatorBoxHLayout->addWidget (sf_light);
+    mHDLed = new QIStateIndicator (KDeviceActivity_Idle);
+    mHDLed->setStateIcon (KDeviceActivity_Idle, QPixmap (":/hd_16px.png"));
+    mHDLed->setStateIcon (KDeviceActivity_Reading, QPixmap (":/hd_read_16px.png"));
+    mHDLed->setStateIcon (KDeviceActivity_Writing, QPixmap (":/hd_write_16px.png"));
+    mHDLed->setStateIcon (KDeviceActivity_Null, QPixmap (":/hd_disabled_16px.png"));
+    indicatorBoxHLayout->addWidget (mHDLed);
+    mCDLed = new QIStateIndicator (KDeviceActivity_Idle);
+    mCDLed->setStateIcon (KDeviceActivity_Idle, QPixmap (":/cd_16px.png"));
+    mCDLed->setStateIcon (KDeviceActivity_Reading, QPixmap (":/cd_read_16px.png"));
+    mCDLed->setStateIcon (KDeviceActivity_Writing, QPixmap (":/cd_write_16px.png"));
+    mCDLed->setStateIcon (KDeviceActivity_Null, QPixmap (":/cd_disabled_16px.png"));
+    indicatorBoxHLayout->addWidget (mCDLed);
+#if 0 /* TODO: Allow to setup status-bar! */
+    mFDLed = new QIStateIndicator (KDeviceActivity_Idle);
+    mFDLed->setStateIcon (KDeviceActivity_Idle, QPixmap (":/fd_16px.png"));
+    mFDLed->setStateIcon (KDeviceActivity_Reading, QPixmap (":/fd_read_16px.png"));
+    mFDLed->setStateIcon (KDeviceActivity_Writing, QPixmap (":/fd_write_16px.png"));
+    mFDLed->setStateIcon (KDeviceActivity_Null, QPixmap (":/fd_disabled_16px.png"));
+    indicatorBoxHLayout->addWidget (mFDLed);
+#endif
+    mNetLed = new QIStateIndicator (KDeviceActivity_Idle);
+    mNetLed->setStateIcon (KDeviceActivity_Idle, QPixmap (":/nw_16px.png"));
+    mNetLed->setStateIcon (KDeviceActivity_Reading, QPixmap (":/nw_read_16px.png"));
+    mNetLed->setStateIcon (KDeviceActivity_Writing, QPixmap (":/nw_write_16px.png"));
+    mNetLed->setStateIcon (KDeviceActivity_Null, QPixmap (":/nw_disabled_16px.png"));
+    indicatorBoxHLayout->addWidget (mNetLed);
+    mUSBLed = new QIStateIndicator (KDeviceActivity_Idle);
+    mUSBLed->setStateIcon (KDeviceActivity_Idle, QPixmap (":/usb_16px.png"));
+    mUSBLed->setStateIcon (KDeviceActivity_Reading, QPixmap (":/usb_read_16px.png"));
+    mUSBLed->setStateIcon (KDeviceActivity_Writing, QPixmap (":/usb_write_16px.png"));
+    mUSBLed->setStateIcon (KDeviceActivity_Null, QPixmap (":/usb_disabled_16px.png"));
+    indicatorBoxHLayout->addWidget (mUSBLed);
+    mSFLed = new QIStateIndicator (KDeviceActivity_Idle);
+    mSFLed->setStateIcon (KDeviceActivity_Idle, QPixmap (":/shared_folder_16px.png"));
+    mSFLed->setStateIcon (KDeviceActivity_Reading, QPixmap (":/shared_folder_read_16px.png"));
+    mSFLed->setStateIcon (KDeviceActivity_Writing, QPixmap (":/shared_folder_write_16px.png"));
+    mSFLed->setStateIcon (KDeviceActivity_Null, QPixmap (":/shared_folder_disabled_16px.png"));
+    indicatorBoxHLayout->addWidget (mSFLed);
 
     /* virtualization */
@@ -583,125 +601,102 @@
     indicatorBoxHLayout->addWidget (separator);
 
-#if 0 // do not show these indicators, information overload
-    /* vrdp state */
-    vrdp_state = new QIStateIndicator (0, indicatorBox, "vrdp_state", Qt::WNoAutoErase);
-    vrdp_state->setStateIcon (0, QPixmap (":/vrdp_disabled_16px.png"));
-    vrdp_state->setStateIcon (1, QPixmap (":/vrdp_16px.png"));
-    /* auto resize state */
-    autoresize_state = new QIStateIndicator (1, indicatorBox, "autoresize_state", Qt::WNoAutoErase);
-    autoresize_state->setStateIcon (0, QPixmap (":/auto_resize_off_disabled_16px.png"));
-    autoresize_state->setStateIcon (1, QPixmap (":/auto_resize_off_16px.png"));
-    autoresize_state->setStateIcon (2, QPixmap (":/auto_resize_on_disabled_16px.png"));
-    autoresize_state->setStateIcon (3, QPixmap (":/auto_resize_on_16px.png"));
-#endif
-
     /* mouse */
-    mouse_state = new QIStateIndicator (0);
-    mouse_state->setStateIcon (0, QPixmap (":/mouse_disabled_16px.png"));
-    mouse_state->setStateIcon (1, QPixmap (":/mouse_16px.png"));
-    mouse_state->setStateIcon (2, QPixmap (":/mouse_seamless_16px.png"));
-    mouse_state->setStateIcon (3, QPixmap (":/mouse_can_seamless_16px.png"));
-    mouse_state->setStateIcon (4, QPixmap (":/mouse_can_seamless_uncaptured_16px.png"));
-    indicatorBoxHLayout->addWidget (mouse_state);
+    mMouseLed = new QIStateIndicator (0);
+    mMouseLed->setStateIcon (0, QPixmap (":/mouse_disabled_16px.png"));
+    mMouseLed->setStateIcon (1, QPixmap (":/mouse_16px.png"));
+    mMouseLed->setStateIcon (2, QPixmap (":/mouse_seamless_16px.png"));
+    mMouseLed->setStateIcon (3, QPixmap (":/mouse_can_seamless_16px.png"));
+    mMouseLed->setStateIcon (4, QPixmap (":/mouse_can_seamless_uncaptured_16px.png"));
+    indicatorBoxHLayout->addWidget (mMouseLed);
+
     /* host key */
-    hostkey_hbox = new QWidget();
-    QHBoxLayout *hostkeyHBoxLayout = new QHBoxLayout (hostkey_hbox);
-    VBoxGlobal::setLayoutMargin (hostkeyHBoxLayout, 0);
-    hostkeyHBoxLayout->setSpacing (3);
-    indicatorBoxHLayout->addWidget (hostkey_hbox);
-
-    hostkey_state = new QIStateIndicator (0);
-    hostkey_state->setStateIcon (0, QPixmap (":/hostkey_16px.png"));
-    hostkey_state->setStateIcon (1, QPixmap (":/hostkey_captured_16px.png"));
-    hostkey_state->setStateIcon (2, QPixmap (":/hostkey_pressed_16px.png"));
-    hostkey_state->setStateIcon (3, QPixmap (":/hostkey_captured_pressed_16px.png"));
-    hostkeyHBoxLayout->addWidget (hostkey_state);
-    hostkey_name = new QLabel (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey()));
-    hostkeyHBoxLayout->addWidget (hostkey_name);
+    mHostkeyLedContainer = new QWidget;
+    QHBoxLayout *hostkeyLEDContainerLayout = new QHBoxLayout (mHostkeyLedContainer);
+    VBoxGlobal::setLayoutMargin (hostkeyLEDContainerLayout, 0);
+    hostkeyLEDContainerLayout->setSpacing (3);
+    indicatorBoxHLayout->addWidget (mHostkeyLedContainer);
+
+    mHostkeyLed = new QIStateIndicator (0);
+    mHostkeyLed->setStateIcon (0, QPixmap (":/hostkey_16px.png"));
+    mHostkeyLed->setStateIcon (1, QPixmap (":/hostkey_captured_16px.png"));
+    mHostkeyLed->setStateIcon (2, QPixmap (":/hostkey_pressed_16px.png"));
+    mHostkeyLed->setStateIcon (3, QPixmap (":/hostkey_captured_pressed_16px.png"));
+    hostkeyLEDContainerLayout->addWidget (mHostkeyLed);
+    mHostkeyName = new QLabel (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey()));
+    hostkeyLEDContainerLayout->addWidget (mHostkeyName);
+
+#if 0 /* TODO: Allow to setup status-bar! */
+    /* VRDP Led */
+    mVrdpLed = new QIStateIndicator (0, indicatorBox, "mVrdpLed", Qt::WNoAutoErase);
+    mVrdpLed->setStateIcon (0, QPixmap (":/vrdp_disabled_16px.png"));
+    mVrdpLed->setStateIcon (1, QPixmap (":/vrdp_16px.png"));
+    /* Auto-Resize LED */
+    mAutoresizeLed = new QIStateIndicator (1, indicatorBox, "mAutoresizeLed", Qt::WNoAutoErase);
+    mAutoresizeLed->setStateIcon (0, QPixmap (":/auto_resize_off_disabled_16px.png"));
+    mAutoresizeLed->setStateIcon (1, QPixmap (":/auto_resize_off_16px.png"));
+    mAutoresizeLed->setStateIcon (2, QPixmap (":/auto_resize_on_disabled_16px.png"));
+    mAutoresizeLed->setStateIcon (3, QPixmap (":/auto_resize_on_16px.png"));
+#endif
+
     /* add to statusbar */
     statusBar()->addPermanentWidget (indicatorBox, 0);
 
-    /////////////////////////////////////////////////////////////////////////
-
+    /* Retranslate UI */
     retranslateUi();
 
-    setWindowTitle (caption_prefix);
-
-    ///// Connections ///////////////////////////////////////////////////////
-
-    connect (mVmFullscreenAction, SIGNAL (toggled (bool)),
-             this, SLOT (vmFullscreen (bool)));
-    connect (mVmSeamlessAction, SIGNAL (toggled (bool)),
-             this, SLOT (vmSeamless (bool)));
-    connect (mVmAutoresizeGuestAction, SIGNAL (toggled (bool)),
-             this, SLOT (vmAutoresizeGuest (bool)));
-    connect (mVmAdjustWindowAction, SIGNAL (triggered()),
-             this, SLOT (vmAdjustWindow()));
-
-    connect (mVmTypeCADAction, SIGNAL(triggered()), this, SLOT(vmTypeCAD()));
-#if defined(Q_WS_X11)
-    connect (mVmTypeCABSAction, SIGNAL(triggered()), this, SLOT(vmTypeCABS()));
-#endif
-    connect (mVmResetAction, SIGNAL(triggered()), this, SLOT (vmReset()));
-    connect (mVmPauseAction, SIGNAL(toggled (bool)), this, SLOT (vmPause (bool)));
+    setWindowTitle (mCaptionPrefix);
+
+    /* Connections */
+    connect (mVmFullscreenAction, SIGNAL (toggled (bool)), this, SLOT (vmFullscreen (bool)));
+    connect (mVmSeamlessAction, SIGNAL (toggled (bool)), this, SLOT (vmSeamless (bool)));
+    connect (mVmAutoresizeGuestAction, SIGNAL (toggled (bool)), this, SLOT (vmAutoresizeGuest (bool)));
+    connect (mVmAdjustWindowAction, SIGNAL (triggered()), this, SLOT (vmAdjustWindow()));
+    connect (mVmDisableMouseIntegrAction, SIGNAL (toggled (bool)), this, SLOT (vmDisableMouseIntegration (bool)));
+    connect (mVmTypeCADAction, SIGNAL (triggered()), this, SLOT (vmTypeCAD()));
+#ifdef Q_WS_X11
+    connect (mVmTypeCABSAction, SIGNAL (triggered()), this, SLOT (vmTypeCABS()));
+#endif
+    connect (mVmTakeSnapshotAction, SIGNAL (triggered()), this, SLOT (vmTakeSnapshot()));
+    connect (mVmShowInformationDlgAction, SIGNAL (triggered()), this, SLOT (vmShowInfoDialog()));
+    connect (mVmResetAction, SIGNAL (triggered()), this, SLOT (vmReset()));
+    connect (mVmPauseAction, SIGNAL (toggled (bool)), this, SLOT (vmPause (bool)));
     connect (mVmACPIShutdownAction, SIGNAL (triggered()), this, SLOT (vmACPIShutdown()));
-    connect (mVmCloseAction, SIGNAL(triggered()), this, SLOT (vmClose()));
-
-    connect (mVmTakeSnapshotAction, SIGNAL(triggered()), this, SLOT(vmTakeSnapshot()));
-    connect (mVmShowInformationDlgAction, SIGNAL(triggered()), this, SLOT (vmShowInfoDialog()));
-
-    connect (mVmDisableMouseIntegrAction, SIGNAL(toggled (bool)), this, SLOT(vmDisableMouseIntegr (bool)));
-
-    connect (mDevicesMountFloppyImageAction, SIGNAL(triggered()), this, SLOT(devicesMountFloppyImage()));
-    connect (mDevicesUnmountFloppyAction, SIGNAL(triggered()), this, SLOT(devicesUnmountFloppy()));
-    connect (mDevicesMountDVDImageAction, SIGNAL(triggered()), this, SLOT(devicesMountDVDImage()));
-    connect (mDevicesUnmountDVDAction, SIGNAL(triggered()), this, SLOT(devicesUnmountDVD()));
-    connect (mDevicesSwitchVrdpAction, SIGNAL(toggled (bool)), this, SLOT(devicesSwitchVrdp (bool)));
-    connect (mDevicesNetworkDialogAction, SIGNAL(triggered()), this, SLOT(devicesOpenNetworkDialog()));
-    connect (mDevicesSFDialogAction, SIGNAL(triggered()), this, SLOT(devicesOpenSFDialog()));
-    connect (mDevicesInstallGuestToolsAction, SIGNAL(triggered()), this, SLOT(devicesInstallGuestAdditions()));
-
-
-    connect (mDevicesMountFloppyMenu, SIGNAL(aboutToShow()), this, SLOT(prepareFloppyMenu()));
-    connect (mDevicesMountDVDMenu, SIGNAL(aboutToShow()), this, SLOT(prepareDVDMenu()));
-    connect (mDevicesNetworkMenu, SIGNAL(aboutToShow()), this, SLOT(prepareNetworkMenu()));
-    connect (mDevicesSFMenu, SIGNAL(aboutToShow()), this, SLOT(prepareSFMenu()));
-
-    connect (statusBar(), SIGNAL(messageChanged (const QString &)), this, SLOT(statusTipChanged (const QString &)));
-
-    connect (mDevicesMountFloppyMenu, SIGNAL(triggered(QAction *)), this, SLOT(captureFloppy(QAction *)));
-    connect (mDevicesMountDVDMenu, SIGNAL(triggered(QAction *)), this, SLOT(captureDVD(QAction *)));
-    connect (mDevicesUSBMenu, SIGNAL(triggered(QAction *)), this, SLOT(switchUSB(QAction *)));
-
-    /* Cleanup the status bar tip when a menu with dynamic items is
-     * hidden. This is necessary for context menus in the first place but also
-     * for normal menus (because Qt will not do it on pressing ESC if the menu
-     * is constructed of dynamic items only) */
-    connect (mDevicesMountFloppyMenu, SIGNAL (aboutToHide()),
-             statusBar(), SLOT (clearMessage()));
-    connect (mDevicesMountDVDMenu, SIGNAL (aboutToHide()),
-             statusBar(), SLOT (clearMessage()));
-
-    connect (fd_light, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
+    connect (mVmCloseAction, SIGNAL (triggered()), this, SLOT (vmClose()));
+
+    connect (mDevicesStorageMenu, 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()));
+    connect (mDevicesSwitchVrdpAction, SIGNAL (toggled (bool)), this, SLOT (devicesSwitchVrdp (bool)));
+    connect (mDevicesInstallGuestToolsAction, SIGNAL (triggered()), this, SLOT (devicesInstallGuestAdditions()));
+
+    connect (mHDLed, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
              this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *)));
-    connect (cd_light, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
+    connect (mCDLed, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
              this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *)));
-    connect (usb_light, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
+#if 0 /* TODO: Allow to setup status-bar! */
+    connect (mFDLed, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
              this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *)));
-    connect (sf_light, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
+#endif
+    connect (mNetLed, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
              this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *)));
-    connect (net_light, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
+    connect (mUSBLed, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
              this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *)));
-
-#if 0
-    connect (vrdp_state, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
+    connect (mSFLed, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
              this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *)));
-    connect (autoresize_state, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
+    connect (mMouseLed, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
              this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *)));
-#endif
-    connect (mouse_state, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
+#if 0 /* TODO: Allow to setup status-bar! */
+    connect (mVrdpLed, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
              this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *)));
-
-    /* watch global settings changes */
+    connect (mAutoresizeLed, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)),
+             this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *)));
+#endif
+
+    /* Watch global settings changes */
     connect (&vboxGlobal().settings(), SIGNAL (propertyChanged (const char *, const char *)),
              this, SLOT (processGlobalSettingChange (const char *, const char *)));
@@ -725,11 +720,11 @@
     /* For the status bar on Cocoa */
     setUnifiedTitleAndToolBarOnMac (true);
-
 # ifdef VBOX_WITH_ICHAT_THEATER
-//    int setAttr[] = { kHIWindowBitDoesNotShowBadgeInDock, 0 };
-//    HIWindowChangeAttributes (window, setAttr, NULL);
+    // int setAttr[] = { kHIWindowBitDoesNotShowBadgeInDock, 0 };
+    // HIWindowChangeAttributes (window, setAttr, 0);
     initSharedAVManager();
 # endif
 #endif
+
     mMaskShift.scale (0, 0, Qt::IgnoreAspectRatio);
 }
@@ -740,12 +735,7 @@
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
-    /* destroy the debugger gui */
     dbgDestroy();
 #endif
 }
-
-//
-// Public members
-/////////////////////////////////////////////////////////////////////////////
 
 /**
@@ -754,9 +744,9 @@
  *  Used by VBoxGlobal::startMachine(), should not be called directly.
  */
-bool VBoxConsoleWnd::openView (const CSession &session)
+bool VBoxConsoleWnd::openView (const CSession &aSession)
 {
     LogFlowFuncEnter();
 
-    if (console)
+    if (mConsole)
     {
         LogFlowFunc (("Already opened\n"));
@@ -772,25 +762,17 @@
 #endif /* Q_WS_MAC */
 
-    csession = session;
+    mSession = aSession;
 
     if (!centralWidget())
     {
         setCentralWidget (new QWidget (this));
-        QGridLayout *pMainLayout = new QGridLayout(centralWidget());
+        QGridLayout *pMainLayout = new QGridLayout (centralWidget());
         VBoxGlobal::setLayoutMargin (pMainLayout, 0);
         pMainLayout->setSpacing (0);
 
-        mShiftingSpacerLeft = new QSpacerItem (0, 0,
-                                               QSizePolicy::Fixed,
-                                               QSizePolicy::Fixed);
-        mShiftingSpacerTop = new QSpacerItem (0, 0,
-                                              QSizePolicy::Fixed,
-                                              QSizePolicy::Fixed);
-        mShiftingSpacerRight = new QSpacerItem (0, 0,
-                                                QSizePolicy::Fixed,
-                                                QSizePolicy::Fixed);
-        mShiftingSpacerBottom = new QSpacerItem (0, 0,
-                                                 QSizePolicy::Fixed,
-                                                 QSizePolicy::Fixed);
+        mShiftingSpacerLeft = new QSpacerItem (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
+        mShiftingSpacerTop = new QSpacerItem (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
+        mShiftingSpacerRight = new QSpacerItem (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
+        mShiftingSpacerBottom = new QSpacerItem (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
         pMainLayout->addItem (mShiftingSpacerTop, 0, 0, 1, -1);
         pMainLayout->addItem (mShiftingSpacerLeft, 1, 0);
@@ -801,28 +783,26 @@
     mVmPauseAction->setChecked (false);
 
-    VBoxDefs::RenderMode mode = vboxGlobal().vmRenderMode();
-
-    CConsole cconsole = csession.GetConsole();
-    AssertWrapperOk (csession);
-
-    CMachine cmachine = csession.GetMachine();
+    CConsole console = mSession.GetConsole();
+    AssertWrapperOk (mSession);
+
+    CMachine machine = mSession.GetMachine();
 
 #ifdef VBOX_WITH_VIDEOHWACCEL
     /* Need to force the QGL framebuffer in case 2D Video Acceleration is supported & enabled */
-    bool bAccelerate2DVideo = cmachine.GetAccelerate2DVideoEnabled() && VBoxGlobal::isAcceleration2DVideoAvailable();
-#endif
-
-    console = new VBoxConsoleView (this, cconsole, mode,
+    bool bAccelerate2DVideo = machine.GetAccelerate2DVideoEnabled() && VBoxGlobal::isAcceleration2DVideoAvailable();
+#endif
+
+    mConsole = new VBoxConsoleView (this, console, vboxGlobal().vmRenderMode(),
 #ifdef VBOX_WITH_VIDEOHWACCEL
-                    bAccelerate2DVideo,
-#endif
-                    centralWidget());
-    static_cast <QGridLayout*> (centralWidget()->layout())->addWidget (console, 1, 1, Qt::AlignVCenter | Qt::AlignHCenter);
+                                    bAccelerate2DVideo,
+#endif
+                                    centralWidget());
+    qobject_cast <QGridLayout*> (centralWidget()->layout())->addWidget (mConsole, 1, 1, Qt::AlignVCenter | Qt::AlignHCenter);
 
     /* Mini toolbar */
-    bool isActive = !(cmachine.GetExtraData (VBoxDefs::GUI_ShowMiniToolBar) == "no");
-    bool isAtTop = (cmachine.GetExtraData (VBoxDefs::GUI_MiniToolBarAlignment) == "top");
-    bool isAutoHide = !(cmachine.GetExtraData (VBoxDefs::GUI_MiniToolBarAutoHide) == "off");
-    QList <QMenu*> menus (QList <QMenu*> () << mMiniVMMenu << mDevicesMenu);
+    bool isActive = !(machine.GetExtraData (VBoxDefs::GUI_ShowMiniToolBar) == "no");
+    bool isAtTop = (machine.GetExtraData (VBoxDefs::GUI_MiniToolBarAlignment) == "top");
+    bool isAutoHide = !(machine.GetExtraData (VBoxDefs::GUI_MiniToolBarAutoHide) == "off");
+    QList <QMenu*> menus (QList <QMenu*>() << mVMMenuMini << mDevicesMenu);
     mMiniToolBar = new VBoxMiniToolBar (centralWidget(), isAtTop ? VBoxMiniToolBar::AlignTop : VBoxMiniToolBar::AlignBottom,
                                         isActive, isAutoHide);
@@ -838,10 +818,10 @@
     /* Not on Mac OS X. The dock icon is handled below. */
 #ifndef Q_WS_MAC
-    setWindowIcon (vboxGlobal().vmGuestOSTypeIcon (cmachine.GetOSTypeId()));
+    setWindowIcon (vboxGlobal().vmGuestOSTypeIcon (machine.GetOSTypeId()));
 #endif
 
     /* Restore the position of the window and some options */
     {
-        QString str = cmachine.GetExtraData (VBoxDefs::GUI_LastWindowPosition);
+        QString str = machine.GetExtraData (VBoxDefs::GUI_LastWindowPosition);
 
         bool ok = false, max = false;
@@ -866,5 +846,5 @@
 
             /* Normalize to the optimal size */
-            console->normalizeGeometry (true /* adjustPosition */);
+            mConsole->normalizeGeometry (true /* adjustPosition */);
 
             if (max)
@@ -872,5 +852,5 @@
                 /* Maximize if needed */
                 setWindowState (windowState() | Qt::WindowMaximized);
-                was_max = max;
+                mWasMax = max;
             }
         }
@@ -878,5 +858,5 @@
         {
             /* Normalize to the optimal size */
-            console->normalizeGeometry (true /* adjustPosition */);
+            mConsole->normalizeGeometry (true /* adjustPosition */);
 
             /* Move newly created window to the screen center. */
@@ -892,25 +872,25 @@
 
         mVmSeamlessAction->setEnabled (false);
-        str = cmachine.GetExtraData (VBoxDefs::GUI_Seamless);
+        str = machine.GetExtraData (VBoxDefs::GUI_Seamless);
         if (str == "on")
             mVmSeamlessAction->setChecked (true);
 
-        str = cmachine.GetExtraData (VBoxDefs::GUI_AutoresizeGuest);
+        str = machine.GetExtraData (VBoxDefs::GUI_AutoresizeGuest);
         if (str != "off")
             mVmAutoresizeGuestAction->setChecked (true);
 
-        str = cmachine.GetExtraData (VBoxDefs::GUI_FirstRun);
+        str = machine.GetExtraData (VBoxDefs::GUI_FirstRun);
         if (str == "yes")
             mIsFirstTimeStarted = true;
         else if (!str.isEmpty())
-            cmachine.SetExtraData (VBoxDefs::GUI_FirstRun, QString::null);
-
-        str = cmachine.GetExtraData (VBoxDefs::GUI_SaveMountedAtRuntime);
+            machine.SetExtraData (VBoxDefs::GUI_FirstRun, QString::null);
+
+        str = machine.GetExtraData (VBoxDefs::GUI_SaveMountedAtRuntime);
         if (str == "no")
             mIsAutoSaveMedia = false;
 
         /* Check if one of extended modes to be activated on loading */
-        QString fsMode = cmachine.GetExtraData (VBoxDefs::GUI_Fullscreen);
-        QString slMode = cmachine.GetExtraData (VBoxDefs::GUI_Seamless);
+        QString fsMode = machine.GetExtraData (VBoxDefs::GUI_Fullscreen);
+        QString slMode = machine.GetExtraData (VBoxDefs::GUI_Seamless);
         bool extendedMode = fsMode == "on" || slMode == "on";
 
@@ -918,15 +898,14 @@
          * console resize event which will come from VGA Device on loading. */
         if (extendedMode)
-            console->requestToResize (QSize (w, h - menuBar()->height() - statusBar()->height()));
+            mConsole->requestToResize (QSize (w, h - menuBar()->height() - statusBar()->height()));
     }
 
     /* initialize usb stuff */
-    CUSBController usbctl = cmachine.GetUSBController();
+    CUSBController usbctl = machine.GetUSBController();
     if (usbctl.isNull())
     {
         /* hide usb_menu & usb_separator & usb_status_led */
         mDevicesUSBMenu->setVisible (false);
-        mDevicesUSBMenuSeparator->setVisible (false);
-        usb_light->setHidden (true);
+        mUSBLed->setHidden (true);
     }
     else
@@ -934,41 +913,34 @@
         bool isUSBEnabled = usbctl.GetEnabled();
         mDevicesUSBMenu->setEnabled (isUSBEnabled);
-        mDevicesUSBMenu->setConsole (cconsole);
-        usb_light->setState (isUSBEnabled ? KDeviceActivity_Idle
-                                          : KDeviceActivity_Null);
+        mDevicesUSBMenu->setConsole (console);
+        mUSBLed->setState (isUSBEnabled ? KDeviceActivity_Idle : KDeviceActivity_Null);
     }
 
     /* initialize vrdp stuff */
-    CVRDPServer vrdpsrv = cmachine.GetVRDPServer();
+    CVRDPServer vrdpsrv = machine.GetVRDPServer();
     if (vrdpsrv.isNull())
     {
         /* hide vrdp_menu_action & vrdp_separator & vrdp_status_icon */
         mDevicesSwitchVrdpAction->setVisible (false);
-        mDevicesVRDPMenuSeparator->setVisible (false);
-#if 0
-        vrdp_state->setHidden (true);
+        mDevicesSwitchVrdpSeparator->setVisible (false);
+#if 0 /* TODO: Allow to setup status-bar! */
+        mVrdpLed->setHidden (true);
 #endif
     }
 
     /* start an idle timer that will update device lighths */
-    connect (idle_timer, SIGNAL (timeout()), SLOT (updateDeviceLights()));
-    idle_timer->start (50);
-
-    connect (console, SIGNAL (mouseStateChanged (int)),
-             this, SLOT (updateMouseState (int)));
-    connect (console, SIGNAL (keyboardStateChanged (int)),
-             hostkey_state, SLOT (setState (int)));
-    connect (console, SIGNAL (machineStateChanged (KMachineState)),
-             this, SLOT (updateMachineState (KMachineState)));
-    connect (console, SIGNAL (additionsStateChanged (const QString&, bool, bool, bool)),
+    connect (mIdleTimer, SIGNAL (timeout()), SLOT (updateDeviceLights()));
+    mIdleTimer->start (50);
+
+    connect (mConsole, SIGNAL (mouseStateChanged (int)), this, SLOT (updateMouseState (int)));
+    connect (mConsole, SIGNAL (keyboardStateChanged (int)), mHostkeyLed, SLOT (setState (int)));
+    connect (mConsole, SIGNAL (machineStateChanged (KMachineState)), this, SLOT (updateMachineState (KMachineState)));
+    connect (mConsole, SIGNAL (additionsStateChanged (const QString&, bool, bool, bool)),
              this, SLOT (updateAdditionsState (const QString &, bool, bool, bool)));
-    connect (console, SIGNAL (mediaDriveChanged (VBoxDefs::MediumType)),
+    connect (mConsole, SIGNAL (mediaDriveChanged (VBoxDefs::MediumType)),
              this, SLOT (updateMediaDriveState (VBoxDefs::MediumType)));
-    connect (console, SIGNAL (usbStateChange()),
-             this, SLOT (updateUsbState()));
-    connect (console, SIGNAL (networkStateChange()),
-             this, SLOT (updateNetworkAdaptersState()));
-    connect (console, SIGNAL (sharedFoldersChanged()),
-             this, SLOT (updateSharedFoldersState()));
+    connect (mConsole, SIGNAL (usbStateChange()), this, SLOT (updateUsbState()));
+    connect (mConsole, SIGNAL (networkStateChange()), this, SLOT (updateNetworkAdaptersState()));
+    connect (mConsole, SIGNAL (sharedFoldersChanged()), this, SLOT (updateSharedFoldersState()));
 
 #ifdef Q_WS_MAC
@@ -976,12 +948,12 @@
     /* Default to true if it is an empty value */
     bool f = (testStr.isEmpty() || testStr == "true");
-    console->setDockIconEnabled (f);
-    console->updateDockOverlay();
-#endif
-
-    /* set the correct initial machine_state value */
-    machine_state = cconsole.GetState();
-
-    console->normalizeGeometry (false /* adjustPosition */);
+    mConsole->setDockIconEnabled (f);
+    mConsole->updateDockOverlay();
+#endif
+
+    /* set the correct initial mMachineState value */
+    mMachineState = console.GetState();
+
+    mConsole->normalizeGeometry (false /* adjustPosition */);
 
     updateAppearanceOf (AllStuff);
@@ -1004,206 +976,4 @@
 }
 
-void VBoxConsoleWnd::activateUICustomizations()
-{
-    VBoxGlobalSettings settings = vboxGlobal().settings();
-    /* Process known keys */
-    menuBar()->setHidden (settings.isFeatureActive ("noMenuBar"));
-    statusBar()->setHidden (settings.isFeatureActive ("noStatusBar"));
-}
-
-void VBoxConsoleWnd::finalizeOpenView()
-{
-    LogFlowFuncEnter();
-
-    /* Notify the console scroll-view about the console-window is opened. */
-    console->onViewOpened();
-
-    bool saved = machine_state == KMachineState_Saved;
-
-    CMachine cmachine = csession.GetMachine();
-    CConsole cconsole = console->console();
-
-    if (mIsFirstTimeStarted)
-    {
-        VBoxVMFirstRunWzd wzd (cmachine, this);
-        wzd.exec();
-
-        /* Remove GUI_FirstRun extra data key from the machine settings
-         * file after showing the wizard once. */
-        cmachine.SetExtraData (VBoxDefs::GUI_FirstRun, QString::null);
-    }
-
-    /* start the VM */
-    CProgress progress =    vboxGlobal().isStartPausedEnabled()
-                         || vboxGlobal().isDebuggerAutoShowEnabled()
-                       ? cconsole.PowerUpPaused()
-                       : cconsole.PowerUp();
-
-    /* check for an immediate failure */
-    if (!cconsole.isOk())
-    {
-        vboxProblem().cannotStartMachine (cconsole);
-        /* close this window (this will call closeView()) */
-        close();
-
-        LogFlowFunc (("Error starting VM\n"));
-        LogFlowFuncLeave();
-        return;
-    }
-
-    console->attach();
-
-    /* Disable auto closure because we want to have a chance to show the
-     * error dialog on startup failure */
-    no_auto_close = true;
-
-    /* show the "VM starting / restoring" progress dialog */
-
-    if (saved)
-        vboxProblem().showModalProgressDialog (progress, cmachine.GetName(),
-                                               this, 0);
-    else
-        vboxProblem().showModalProgressDialog (progress, cmachine.GetName(),
-                                               this);
-
-    if (progress.GetResultCode() != 0)
-    {
-        vboxProblem().cannotStartMachine (progress);
-        /* close this window (this will call closeView()) */
-        close();
-
-        LogFlowFunc (("Error starting VM\n"));
-        LogFlowFuncLeave();
-        return;
-    }
-
-    no_auto_close = false;
-
-    /* Check if we missed a really quick termination after successful
-     * startup, and process it if we did. */
-    if (machine_state < KMachineState_Running)
-    {
-        close();
-        LogFlowFuncLeave();
-        return;
-    }
-
-    /* Currently the machine is started and the guest API could be used...
-     * Checking if the fullscreen mode should be activated */
-    QString str = cmachine.GetExtraData (VBoxDefs::GUI_Fullscreen);
-    if (str == "on")
-        mVmFullscreenAction->setChecked (true);
-
-    /* If seamless mode should be enabled then check if it is enabled
-     * currently and re-enable it if seamless is supported */
-    if (   mVmSeamlessAction->isChecked()
-        && mIsSeamlessSupported
-        && mIsGraphicsSupported)
-        toggleFullscreenMode (true, true);
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    /* Open the debugger in "full screen" mode requested by the user. */
-    else if (vboxGlobal().isDebuggerAutoShowEnabled())
-    {
-        /* console in upper left corner of the desktop. */
-        QRect rct(0, 0, 0, 0);
-        QDesktopWidget *desktop = QApplication::desktop();
-        if (desktop)
-            rct = desktop->availableGeometry(pos());
-        move (QPoint (rct.x(), rct.y()));
-
-        if (vboxGlobal().isDebuggerAutoShowStatisticsEnabled())
-            dbgShowStatistics();
-        if (vboxGlobal().isDebuggerAutoShowCommandLineEnabled())
-            dbgShowCommandLine();
-
-        if (!vboxGlobal().isStartPausedEnabled())
-            console->pause (false);
-    }
-#endif
-
-    mIsOpenViewFinished = true;
-    LogFlowFuncLeave();
-
-#ifdef VBOX_WITH_UPDATE_REQUEST
-    vboxGlobal().showUpdateDialog (false /* aForce */);
-#endif
-
-    /* Finally check the status of required features. */
-    checkRequiredFeatures();
-
-    /* Re-request all the static values finally after
-     * view is really opened and attached. */
-    updateAppearanceOf (VirtualizationStuff);
-}
-
-/**
- *  Closes the console view opened by openView().
- *  Does nothing if no console view was opened.
- */
-void VBoxConsoleWnd::closeView()
-{
-    LogFlowFuncEnter();
-
-    if (!console)
-    {
-        LogFlow (("Already closed!\n"));
-        LogFlowFuncLeave();
-        return;
-    }
-
-    console->detach();
-    centralWidget()->layout()->removeWidget (console);
-    delete console;
-    console = 0;
-    csession.Close();
-    csession.detach();
-
-    LogFlowFuncLeave();
-}
-
-/**
- *  Refreshes the console view by readressing this call to
- *  VBoxConsoleView::refresh(). Does nothing if the console view doesn't
- *  exist (i.e., as before openView() or after stopView()).
- */
-void VBoxConsoleWnd::refreshView()
-{
-    if ( console ) {
-        console->refresh();
-    }
-}
-
-/**
- *  This slot is called just after leaving the fullscreen/seamless mode,
- *  when the console was resized to previous size.
- */
-void VBoxConsoleWnd::onExitFullscreen()
-{
-    console->setIgnoreMainwndResize (false);
-}
-
-void VBoxConsoleWnd::unlockActionsSwitch()
-{
-    if (mIsSeamless)
-        mVmSeamlessAction->setEnabled (true);
-    else if (mIsFullscreen)
-        mVmFullscreenAction->setEnabled (true);
-    else
-    {
-        mVmSeamlessAction->setEnabled (mIsSeamlessSupported && mIsGraphicsSupported);
-        mVmFullscreenAction->setEnabled (true);
-    }
-
-#ifdef Q_WS_MAC
-    if (!mIsSeamless)
-    {
-        /* Fade back to the normal gamma */
-        CGDisplayFade (mFadeToken, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, false);
-        CGReleaseDisplayFadeReservation (mFadeToken);
-    }
-    console->setMouseCoalescingEnabled (true);
-#endif
-}
-
 void VBoxConsoleWnd::setMouseIntegrationLocked (bool aDisabled)
 {
@@ -1242,11 +1012,160 @@
 }
 
-//
-// Protected Members
-/////////////////////////////////////////////////////////////////////////////
-
-bool VBoxConsoleWnd::event (QEvent *e)
-{
-    switch (e->type())
+void VBoxConsoleWnd::installGuestAdditionsFrom (const QString &aSource)
+{
+    CVirtualBox vbox = vboxGlobal().virtualBox();
+    QString uuid;
+
+    CMedium image = vbox.FindDVDImage (aSource);
+    if (image.isNull())
+    {
+        image = vbox.OpenDVDImage (aSource, uuid);
+        if (vbox.isOk())
+            uuid = image.GetId();
+    }
+    else
+        uuid = image.GetId();
+
+    if (!vbox.isOk())
+        return vboxProblem().cannotOpenMedium (this, vbox,
+                                               VBoxDefs::MediumType_DVD, aSource);
+
+    Assert (!uuid.isNull());
+    CMachine m = mSession.GetMachine();
+
+    QString ctrName;
+    LONG ctrPort = -1, ctrDevice = -1;
+    /* Searching for the first suitable slot */
+    {
+        CStorageControllerVector controllers = m.GetStorageControllers();
+        int i = 0;
+        while (i < controllers.size() && ctrName.isNull())
+        {
+            CStorageController controller = controllers [i];
+            CMediumAttachmentVector attachments = m.GetMediumAttachmentsOfController (controller.GetName());
+            int j = 0;
+            while (j < attachments.size() && ctrName.isNull())
+            {
+                CMediumAttachment attachment = attachments [j];
+                if (attachment.GetDevice() == KDeviceType_DVD)
+                {
+                    ctrName = controller.GetName();
+                    ctrPort = attachment.GetPort();
+                    ctrDevice = attachment.GetDevice();
+                }
+                ++ j;
+            }
+            ++ i;
+        }
+    }
+
+    if (!ctrName.isNull())
+    {
+        m.MountMedium (ctrName, ctrPort, ctrDevice, uuid);
+        AssertWrapperOk (m);
+        if (m.isOk())
+        {
+            if (mIsAutoSaveMedia)
+            {
+                m.SaveSettings();
+                if (!m.isOk())
+                    vboxProblem().cannotSaveMachineSettings (m);
+            }
+        }
+    }
+    else
+    {
+        /* TODO: Make warning about DVD is missing! */
+    }
+}
+
+void VBoxConsoleWnd::setMask (const QRegion &aRegion)
+{
+    QRegion region = aRegion;
+
+    /* The global mask shift cause of toolbars and such things. */
+    region.translate (mMaskShift.width(), mMaskShift.height());
+
+    /* Including mini toolbar area */
+    QRegion toolBarRegion (mMiniToolBar->mask());
+    toolBarRegion.translate (mMiniToolBar->mapToGlobal (toolBarRegion.boundingRect().topLeft()) - QPoint (1, 0));
+    region += toolBarRegion;
+
+    /* Restrict the drawing to the available space on the screen.
+     * (The &operator is better than the previous used -operator,
+     * because this excludes space around the real screen also.
+     * This is necessary for the mac.) */
+    region &= mStrictedRegion;
+
+#ifdef Q_WS_WIN
+    QRegion difference = mPrevRegion.subtract (region);
+
+    /* Region offset calculation */
+    int fleft = 0, ftop = 0;
+
+    /* Visible region calculation */
+    HRGN newReg = CreateRectRgn (0, 0, 0, 0);
+    CombineRgn (newReg, region.handle(), 0, RGN_COPY);
+    OffsetRgn (newReg, fleft, ftop);
+
+    /* Invisible region calculation */
+    HRGN diffReg = CreateRectRgn (0, 0, 0, 0);
+    CombineRgn (diffReg, difference.handle(), 0, RGN_COPY);
+    OffsetRgn (diffReg, fleft, ftop);
+
+    /* Set the current visible region and clean the previous */
+    SetWindowRgn (winId(), newReg, FALSE);
+    RedrawWindow (0, 0, diffReg, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
+    RedrawWindow (mConsole->viewport()->winId(), 0, 0, RDW_INVALIDATE);
+
+    mPrevRegion = region;
+#elif defined (Q_WS_MAC)
+# if defined (VBOX_GUI_USE_QUARTZ2D)
+    if (vboxGlobal().vmRenderMode() == VBoxDefs::Quartz2DMode)
+    {
+        /* If we are using the Quartz2D backend we have to trigger
+         * an repaint only. All the magic clipping stuff is done
+         * in the paint engine. */
+        ::darwinWindowInvalidateShape (mConsole->viewport());
+    }
+    else
+# endif
+    {
+        /* This is necessary to avoid the flicker by an mask update.
+         * See http://lists.apple.com/archives/Carbon-development/2001/Apr/msg01651.html
+         * for the hint.
+         * There *must* be a better solution. */
+        if (!region.isEmpty())
+            region |= QRect (0, 0, 1, 1);
+        // /* Save the current region for later processing in the darwin event handler. */
+        // mCurrRegion = region;
+        // /* We repaint the screen before the ReshapeCustomWindow command. Unfortunately
+        //  * this command flushes a copy of the backbuffer to the screen after the new
+        //  * mask is set. This leads into a missplaced drawing of the content. Currently
+        //  * no alternative to this and also this is not 100% perfect. */
+        // repaint();
+        // qApp->processEvents();
+        // /* Now force the reshaping of the window. This is definitly necessary. */
+        // ReshapeCustomWindow (reinterpret_cast <WindowPtr> (winId()));
+        QMainWindow::setMask (region);
+        // HIWindowInvalidateShadow (::darwinToWindowRef (mConsole->viewport()));
+    }
+#else
+    QMainWindow::setMask (region);
+#endif
+}
+
+void VBoxConsoleWnd::clearMask()
+{
+#ifdef Q_WS_WIN
+    SetWindowRgn (winId(), 0, TRUE);
+#else
+    QMainWindow::clearMask();
+#endif
+}
+
+bool VBoxConsoleWnd::event (QEvent *aEvent)
+{
+    switch (aEvent->type())
     {
         /* By handling every Resize and Move we keep track of the normal
@@ -1256,5 +1175,5 @@
         case QEvent::Resize:
         {
-            QResizeEvent *re = (QResizeEvent *) e;
+            QResizeEvent *re = (QResizeEvent *) aEvent;
 
             if (!mIsWaitingModeResize && !isWindowMaximized() &&
@@ -1301,5 +1220,5 @@
         case StatusTipEvent::Type:
         {
-            StatusTipEvent *ev = (StatusTipEvent*) e;
+            StatusTipEvent *ev = (StatusTipEvent*) aEvent;
             statusBar()->showMessage (ev->mTip);
             break;
@@ -1309,8 +1228,8 @@
     }
 
-    return QMainWindow::event (e);
-}
-
-void VBoxConsoleWnd::closeEvent (QCloseEvent *e)
+    return QMainWindow::event (aEvent);
+}
+
+void VBoxConsoleWnd::closeEvent (QCloseEvent *aEvent)
 {
     LogFlowFuncEnter();
@@ -1321,7 +1240,7 @@
     static const char *kDiscardCurState = "discardCurState";
 
-    if (!console)
-    {
-        e->accept();
+    if (!mConsole)
+    {
+        aEvent->accept();
         LogFlowFunc (("Console already destroyed!"));
         LogFlowFuncLeave();
@@ -1329,40 +1248,31 @@
     }
 
-    if (machine_state > KMachineState_Paused &&
-        machine_state != KMachineState_Stuck)
-    {
-        /*
-         *  The machine is in some temporary state like Saving or Stopping.
-         *  Ignore the close event. When it is Stopping, it will be soon closed
-         *  anyway from updateMachineState(). In all other cases, an appropriate
-         *  progress dialog will be shown within a few seconds.
-         */
-        e->ignore();
+    if (mMachineState > KMachineState_Paused && mMachineState != KMachineState_Stuck)
+    {
+        /* The machine is in some temporary state like Saving or Stopping.
+         * Ignore the close event. When it is Stopping, it will be soon closed anyway from updateMachineState().
+         * In all other cases, an appropriate progress dialog will be shown within a few seconds. */
+        aEvent->ignore();
+    }
+    else if (mMachineState < KMachineState_Running)
+    {
+        /* The machine has been already powered off or saved or aborted -- close the window immediately. */
+        aEvent->accept();
     }
     else
-    if (machine_state < KMachineState_Running)
-    {
-        /*
-         *  the machine has been already powered off or saved or aborted --
-         *  close the window immediately
-         */
-        e->accept();
-    }
-    else
-    {
-        /* start with ignore the close event */
-        e->ignore();
-
-        bool isACPIEnabled = csession.GetConsole().GetGuestEnteredACPIMode();
+    {
+        /* Start with ignore the close event */
+        aEvent->ignore();
+
+        bool isACPIEnabled = mSession.GetConsole().GetGuestEnteredACPIMode();
 
         bool success = true;
 
-        bool wasPaused = machine_state == KMachineState_Paused ||
-                         machine_state == KMachineState_Stuck;
+        bool wasPaused = mMachineState == KMachineState_Paused || mMachineState == KMachineState_Stuck;
         if (!wasPaused)
         {
             /* Suspend the VM and ignore the close event if failed to do so.
              * pause() will show the error message to the user. */
-            success = console->pause (true);
+            success = mConsole->pause (true);
         }
 
@@ -1371,18 +1281,17 @@
             success = false;
 
-            CMachine cmachine = csession.GetMachine();
+            CMachine machine = mSession.GetMachine();
             VBoxCloseVMDlg dlg (this);
-            QString typeId = cmachine.GetOSTypeId();
+            QString typeId = machine.GetOSTypeId();
             dlg.pmIcon->setPixmap (vboxGlobal().vmGuestOSTypeIcon (typeId));
 
-            /* make the Discard checkbox invisible if there are no snapshots */
-            dlg.mCbDiscardCurState->setVisible (cmachine.GetSnapshotCount() > 0);
-
-            if (machine_state != KMachineState_Stuck)
+            /* Make the Discard checkbox invisible if there are no snapshots */
+            dlg.mCbDiscardCurState->setVisible (machine.GetSnapshotCount() > 0);
+
+            if (mMachineState != KMachineState_Stuck)
             {
-                /* read the last user's choice for the given VM */
-                QStringList lastAction =
-                    cmachine.GetExtraData (VBoxDefs::GUI_LastCloseAction).split (',');
-                AssertWrapperOk (cmachine);
+                /* Read the last user's choice for the given VM */
+                QStringList lastAction = machine.GetExtraData (VBoxDefs::GUI_LastCloseAction).split (',');
+                AssertWrapperOk (machine);
                 if (lastAction [0] == kSave)
                 {
@@ -1396,16 +1305,14 @@
                     dlg.mRbPowerOff->setFocus();
                 }
-                else /* the default is ACPI Shutdown */
+                else /* The default is ACPI Shutdown */
                 {
                     dlg.mRbShutdown->setChecked (true);
                     dlg.mRbShutdown->setFocus();
                 }
-                dlg.mCbDiscardCurState->setChecked (lastAction.count() > 1 &&
-                                                    lastAction [1] == kDiscardCurState);
+                dlg.mCbDiscardCurState->setChecked (lastAction.count() > 1 && lastAction [1] == kDiscardCurState);
             }
             else
             {
-                /* The stuck VM can only be powered off; disable anything
-                 * else and choose PowerOff */
+                /* The stuck VM can only be powered off; disable anything else and choose PowerOff */
                 dlg.mRbSave->setEnabled (false);
                 dlg.mRbShutdown->setEnabled (false);
@@ -1417,20 +1324,18 @@
             if (dlg.exec() == QDialog::Accepted)
             {
-                /* Disable auto closure because we want to have a chance to show the
-                 * error dialog on save state / power off failure. */
-                no_auto_close = true;
-
-                CConsole cconsole = console->console();
+                /* Disable auto closure because we want to have a chance to show
+                 * the error dialog on save state / power off failure. */
+                mNoAutoClose = true;
+
+                CConsole console = mConsole->console();
 
                 if (dlg.mRbSave->isChecked())
                 {
-                    CProgress progress = cconsole.SaveState();
-
-                    if (cconsole.isOk())
+                    CProgress progress = console.SaveState();
+
+                    if (console.isOk())
                     {
-                        /* show the "VM saving" progress dialog */
-                        vboxProblem()
-                            .showModalProgressDialog (progress, cmachine.GetName(),
-                                                      this, 0);
+                        /* Show the "VM saving" progress dialog */
+                        vboxProblem().showModalProgressDialog (progress, machine.GetName(), this, 0);
                         if (progress.GetResultCode() != 0)
                             vboxProblem().cannotSaveMachineState (progress);
@@ -1439,34 +1344,30 @@
                     }
                     else
-                        vboxProblem().cannotSaveMachineState (cconsole);
+                        vboxProblem().cannotSaveMachineState (console);
                 }
-                else
-                if (dlg.mRbShutdown->isChecked())
+                else if (dlg.mRbShutdown->isChecked())
                 {
-                    /* unpause the VM to let it grab the ACPI shutdown event */
-                    console->pause (false);
-                    /* prevent the subsequent unpause request */
+                    /* Unpause the VM to let it grab the ACPI shutdown event */
+                    mConsole->pause (false);
+                    /* Prevent the subsequent unpause request */
                     wasPaused = true;
-                    /* signal ACPI shutdown (if there is no ACPI device, the
+                    /* Signal ACPI shutdown (if there is no ACPI device, the
                      * operation will fail) */
-                    cconsole.PowerButton();
-                    wasShutdown = cconsole.isOk();
+                    console.PowerButton();
+                    wasShutdown = console.isOk();
                     if (!wasShutdown)
-                        vboxProblem().cannotACPIShutdownMachine (cconsole);
-                    /* success is always false because we never accept the close
+                        vboxProblem().cannotACPIShutdownMachine (console);
+                    /* Success is always false because we never accept the close
                      * window action when doing ACPI shutdown */
                     success = false;
                 }
-                else
-                if (dlg.mRbPowerOff->isChecked())
+                else if (dlg.mRbPowerOff->isChecked())
                 {
-                    CProgress progress = cconsole.PowerDown();
-
-                    if (cconsole.isOk())
+                    CProgress progress = console.PowerDown();
+
+                    if (console.isOk())
                     {
-                        /* show the power down progress dialog */
-                        vboxProblem()
-                            .showModalProgressDialog (progress, cmachine.GetName(),
-                                                      this, 0);
+                        /* Show the power down progress dialog */
+                        vboxProblem().showModalProgressDialog (progress, machine.GetName(), this, 0);
                         if (progress.GetResultCode() != 0)
                             vboxProblem().cannotStopMachine (progress);
@@ -1475,5 +1376,5 @@
                     }
                     else
-                        vboxProblem().cannotStopMachine (cconsole);
+                        vboxProblem().cannotStopMachine (console);
 
                     if (success)
@@ -1483,22 +1384,17 @@
                          * will closed anyway */
 
-                        /* discard the current state if requested */
-                        if (dlg.mCbDiscardCurState->isChecked() &&
-                            dlg.mCbDiscardCurState->isVisibleTo (&dlg))
+                        /* Discard the current state if requested */
+                        if (dlg.mCbDiscardCurState->isChecked() && dlg.mCbDiscardCurState->isVisibleTo (&dlg))
                         {
-                            CProgress progress = cconsole.DiscardCurrentState();
-                            if (cconsole.isOk())
+                            CProgress progress = console.DiscardCurrentState();
+                            if (console.isOk())
                             {
-                                /* show the progress dialog */
-                                vboxProblem()
-                                    .showModalProgressDialog (progress,
-                                                              cmachine.GetName(),
-                                                              this);
+                                /* Show the progress dialog */
+                                vboxProblem().showModalProgressDialog (progress, machine.GetName(), this);
                                 if (progress.GetResultCode() != 0)
-                                    vboxProblem()
-                                        .cannotDiscardCurrentState (progress);
+                                    vboxProblem().cannotDiscardCurrentState (progress);
                             }
                             else
-                                vboxProblem().cannotDiscardCurrentState (cconsole);
+                                vboxProblem().cannotDiscardCurrentState (console);
                         }
                     }
@@ -1507,21 +1403,18 @@
                 if (success)
                 {
-                    /* accept the close action on success */
-                    e->accept();
+                    /* Accept the close action on success */
+                    aEvent->accept();
                 }
 
                 if (success || wasShutdown)
                 {
-                    /* read the last user's choice for the given VM */
-                    QStringList prevAction =
-                        cmachine.GetExtraData (VBoxDefs::GUI_LastCloseAction).split (',');
-                    /* memorize the last user's choice for the given VM */
+                    /* Read the last user's choice for the given VM */
+                    QStringList prevAction = machine.GetExtraData (VBoxDefs::GUI_LastCloseAction).split (',');
+                    /* Memorize the last user's choice for the given VM */
                     QString lastAction = kPowerOff;
                     if (dlg.mRbSave->isChecked())
                         lastAction = kSave;
                     else if (dlg.mRbShutdown->isChecked() ||
-                             (dlg.mRbPowerOff->isChecked() &&
-                              prevAction [0] == kShutdown &&
-                              !isACPIEnabled))
+                             (dlg.mRbPowerOff->isChecked() && prevAction [0] == kShutdown && !isACPIEnabled))
                         lastAction = kShutdown;
                     else if (dlg.mRbPowerOff->isChecked())
@@ -1531,19 +1424,17 @@
                     if (dlg.mCbDiscardCurState->isChecked())
                         (lastAction += ",") += kDiscardCurState;
-                    cmachine.SetExtraData (VBoxDefs::GUI_LastCloseAction, lastAction);
-                    AssertWrapperOk (cmachine);
+                    machine.SetExtraData (VBoxDefs::GUI_LastCloseAction, lastAction);
+                    AssertWrapperOk (machine);
                 }
             }
         }
 
-        no_auto_close = false;
-
-        if (machine_state < KMachineState_Running)
-        {
-            /*
-             *  the machine has been stopped while showing the Close or the Pause
-             *  failure dialog -- accept the close event immediately
-             */
-            e->accept();
+        mNoAutoClose = false;
+
+        if (mMachineState < KMachineState_Running)
+        {
+            /* The machine has been stopped while showing the Close or the Pause
+             * failure dialog -- accept the close event immediately. */
+            aEvent->accept();
         }
         else
@@ -1551,12 +1442,12 @@
             if (!success)
             {
-                /* restore the running state if needed */
-                if (!wasPaused && machine_state == KMachineState_Paused)
-                    console->pause (false);
+                /* Restore the running state if needed */
+                if (!wasPaused && mMachineState == KMachineState_Paused)
+                    mConsole->pause (false);
             }
         }
     }
 
-    if (e->isAccepted())
+    if (aEvent->isAccepted())
     {
 #ifndef VBOX_GUI_SEPARATE_VM_PROCESS
@@ -1565,6 +1456,6 @@
 
         /* Stop LED update timer */
-        idle_timer->stop();
-        idle_timer->disconnect (SIGNAL (timeout()), this, SLOT (updateDeviceLights()));
+        mIdleTimer->stop();
+        mIdleTimer->disconnect (SIGNAL (timeout()), this, SLOT (updateDeviceLights()));
 
         /* Hide console window */
@@ -1572,10 +1463,9 @@
 
         /* Save the position of the window and some options */
-        CMachine machine = csession.GetMachine();
+        CMachine machine = mSession.GetMachine();
         QString winPos = QString ("%1,%2,%3,%4")
             .arg (mNormalGeo.x()).arg (mNormalGeo.y())
             .arg (mNormalGeo.width()).arg (mNormalGeo.height());
-        if (isWindowMaximized() || (mIsFullscreen && was_max)
-                          || (mIsSeamless && was_max))
+        if (isWindowMaximized() || (mIsFullscreen && mWasMax) || (mIsSeamless && mWasMax))
             winPos += QString (",%1").arg (VBoxDefs::GUI_LastWindowPosition_Max);
 
@@ -1603,32 +1493,28 @@
     }
 
-    LogFlowFunc (("accepted=%d\n", e->isAccepted()));
+    LogFlowFunc (("accepted=%d\n", aEvent->isAccepted()));
     LogFlowFuncLeave();
 }
 
-#if defined(Q_WS_X11)
-bool VBoxConsoleWnd::x11Event (XEvent *event)
-{
-    // Qt bug: when the console view grabs the keyboard, FocusIn, FocusOut,
-    // WindowActivate and WindowDeactivate Qt events are not properly sent
-    // on top level window (i.e. this) deactivation. The fix is to substiute
-    // the mode in FocusOut X11 event structure to NotifyNormal to cause
-    // Qt to process it as desired.
-    if (console && event->type == FocusOut)
-    {
-        if (event->xfocus.mode == NotifyWhileGrabbed  &&
-            (event->xfocus.detail == NotifyAncestor ||
-             event->xfocus.detail == NotifyInferior ||
-             event->xfocus.detail == NotifyNonlinear))
-        {
-             event->xfocus.mode = NotifyNormal;
+#ifdef Q_WS_X11
+bool VBoxConsoleWnd::x11Event (XEvent *aEvent)
+{
+    /* Qt bug: when the console view grabs the keyboard, FocusIn, FocusOut,
+     * WindowActivate and WindowDeactivate Qt events are not properly sent
+     * on top level window (i.e. this) deactivation. The fix is to substiute
+     * the mode in FocusOut X11 event structure to NotifyNormal to cause
+     * Qt to process it as desired. */
+    if (mConsole && aEvent->type == FocusOut)
+    {
+        if (aEvent->xfocus.mode == NotifyWhileGrabbed  &&
+            (aEvent->xfocus.detail == NotifyAncestor ||
+             aEvent->xfocus.detail == NotifyInferior ||
+             aEvent->xfocus.detail == NotifyNonlinear))
+        {
+             aEvent->xfocus.mode = NotifyNormal;
         }
     }
     return false;
 }
-#endif
-
-#ifdef Q_WS_MAC
-extern void qt_set_sequence_auto_mnemonic (bool on);
 #endif
 
@@ -1640,11 +1526,11 @@
 {
 #ifdef VBOX_OSE
-    caption_prefix = tr ("VirtualBox OSE");
+    mCaptionPrefix = tr ("VirtualBox OSE");
 #else
-    caption_prefix = tr ("Sun VirtualBox");
+    mCaptionPrefix = tr ("Sun VirtualBox");
 #endif
 
 #ifdef VBOX_BLEEDING_EDGE
-    caption_prefix += tr (" EXPERIMENTAL build %1r%2 - %3").arg (RTBldCfgVersion()).arg (RTBldCfgRevisionStr()).arg (VBOX_BLEEDING_EDGE);
+    mCaptionPrefix += tr (" EXPERIMENTAL build %1r%2 - %3").arg (RTBldCfgVersion()).arg (RTBldCfgRevisionStr()).arg (VBOX_BLEEDING_EDGE);
 #endif
     /*
@@ -1661,9 +1547,13 @@
 
     /* VM actions */
-
 #ifdef Q_WS_MAC
     qt_set_sequence_auto_mnemonic (false);
 #endif
 
+    mVmDisMouseIntegrMenu->setToolTip (tr ("Mouse Integration", "enable/disable..."));
+#if 0 /* TODO: Allow to setup status-bar! */
+    mVmAutoresizeMenu->setToolTip (tr ("Auto-resize Guest Display", "enable/disable..."));
+#endif
+
     mVmFullscreenAction->setText (VBoxGlobal::insertKeyToActionText (tr ("&Fullscreen Mode"), "F"));
     mVmFullscreenAction->setStatusTip (tr ("Switch to fullscreen mode" ));
@@ -1672,28 +1562,26 @@
     mVmSeamlessAction->setStatusTip (tr ("Switch to seamless desktop integration mode"));
 
-    mVmDisMouseIntegrMenu->setToolTip (tr ("Mouse Integration",
-                                           "enable/disable..."));
-    mVmAutoresizeMenu->setToolTip (tr ("Auto-resize Guest Display",
-                                       "enable/disable..."));
-    mVmAutoresizeGuestAction->setText (VBoxGlobal::insertKeyToActionText (tr ("Auto-resize &Guest Display"),
-                                                                          "G"));
-    mVmAutoresizeGuestAction->setStatusTip (
-        tr ("Automatically resize the guest display when the window is resized "
-            "(requires Guest Additions)"));
+    mVmAutoresizeGuestAction->setText (VBoxGlobal::insertKeyToActionText (tr ("Auto-resize &Guest Display"), "G"));
+    mVmAutoresizeGuestAction->setStatusTip (tr ("Automatically resize the guest display when the "
+                                                "window is resized (requires Guest Additions)"));
 
     mVmAdjustWindowAction->setText (VBoxGlobal::insertKeyToActionText (tr ("&Adjust Window Size"), "A"));
-    mVmAdjustWindowAction->setStatusTip (
-        tr ("Adjust window size and position to best fit the guest display"));
+    mVmAdjustWindowAction->setStatusTip (tr ("Adjust window size and position to best fit the guest display"));
+
+    /* mVmDisableMouseIntegrAction is set up in updateAppearanceOf() */
 
     mVmTypeCADAction->setText (VBoxGlobal::insertKeyToActionText (tr ("&Insert Ctrl-Alt-Del"), "Del"));
-    mVmTypeCADAction->setStatusTip (
-        tr ("Send the Ctrl-Alt-Del sequence to the virtual machine"));
+    mVmTypeCADAction->setStatusTip (tr ("Send the Ctrl-Alt-Del sequence to the virtual machine"));
 
 #if defined(Q_WS_X11)
-    mVmTypeCABSAction->setText (VBoxGlobal::insertKeyToActionText (tr ("&Insert Ctrl-Alt-Backspace"),
-                                                                   "Backspace"));
-    mVmTypeCABSAction->setStatusTip (
-        tr ("Send the Ctrl-Alt-Backspace sequence to the virtual machine"));
-#endif
+    mVmTypeCABSAction->setText (VBoxGlobal::insertKeyToActionText (tr ("&Insert Ctrl-Alt-Backspace"), "Backspace"));
+    mVmTypeCABSAction->setStatusTip (tr ("Send the Ctrl-Alt-Backspace sequence to the virtual machine"));
+#endif
+
+    mVmTakeSnapshotAction->setText (VBoxGlobal::insertKeyToActionText (tr ("Take &Snapshot..."), "S"));
+    mVmTakeSnapshotAction->setStatusTip (tr ("Take a snapshot of the virtual machine"));
+
+    mVmShowInformationDlgAction->setText (VBoxGlobal::insertKeyToActionText (tr ("Session I&nformation Dialog"), "N"));
+    mVmShowInformationDlgAction->setStatusTip (tr ("Show Session Information Dialog"));
 
     mVmResetAction->setText (VBoxGlobal::insertKeyToActionText (tr ("&Reset"), "R"));
@@ -1708,6 +1596,5 @@
     mVmACPIShutdownAction->setText (VBoxGlobal::insertKeyToActionText (tr ("ACPI S&hutdown"), "H"));
 #endif /* !Q_WS_MAC */
-    mVmACPIShutdownAction->setStatusTip (
-        tr ("Send the ACPI Power Button press event to the virtual machine"));
+    mVmACPIShutdownAction->setStatusTip (tr ("Send the ACPI Power Button press event to the virtual machine"));
 
     mVmCloseAction->setText (VBoxGlobal::insertKeyToActionText (tr ("&Close..." ), "Q"));
@@ -1715,52 +1602,27 @@
     mVmCloseAction->setMenuRole (QAction::QuitRole);
 
-    mVmTakeSnapshotAction->setText (VBoxGlobal::insertKeyToActionText (tr ("Take &Snapshot..."), "S"));
-    mVmTakeSnapshotAction->setStatusTip (tr ("Take a snapshot of the virtual machine"));
-
-    mVmShowInformationDlgAction->setText (VBoxGlobal::insertKeyToActionText (tr ("Session I&nformation Dialog"),
-                                                                             "N"));
-    mVmShowInformationDlgAction->setStatusTip (tr ("Show Session Information Dialog"));
-
-    /* mVmDisableMouseIntegrAction is set up in updateAppearanceOf() */
-
     /* Devices actions */
-
-    mDevicesMountFloppyImageAction->setText (tr ("&Floppy Image..."));
-    mDevicesMountFloppyImageAction->setStatusTip (tr ("Mount a floppy image file"));
-
-    mDevicesUnmountFloppyAction->setText (tr ("Unmount F&loppy"));
-    mDevicesUnmountFloppyAction->setStatusTip (
-        tr ("Unmount the currently mounted floppy media"));
-
-    mDevicesMountDVDImageAction->setText (tr ("&CD/DVD-ROM Image..."));
-    mDevicesMountDVDImageAction->setStatusTip (
-        tr ("Mount a CD/DVD-ROM image file"));
-
-    mDevicesUnmountDVDAction->setText (tr ("Unmount C&D/DVD-ROM"));
-    mDevicesUnmountDVDAction->setStatusTip (
-        tr ("Unmount the currently mounted CD/DVD-ROM media"));
-
-    /* mDevicesVRDPMenu->setToolTip (tr ("Remote Desktop (RDP) Server",
-                                     "enable/disable...")); */
+    mDevicesStorageDialogAction->setText (tr ("&Storage Devices..."));
+    mDevicesStorageDialogAction->setStatusTip (tr ("Open the dialog to change settings of the storage devices"));
+
+    mDevicesNetworkDialogAction->setText (tr ("&Network Adapters..."));
+    mDevicesNetworkDialogAction->setStatusTip (tr ("Open the dialog to change settings of the network adapters"));
+
+    mDevicesSFDialogAction->setText (tr ("&Shared Folders..."));
+    mDevicesSFDialogAction->setStatusTip (tr ("Open the dialog to operate on shared folders"));
+
     mDevicesSwitchVrdpAction->setText (tr ("Remote Dis&play"));
-    mDevicesSwitchVrdpAction->setStatusTip (
-        tr ("Enable or disable remote desktop (RDP) connections to this machine"));
-
-    mDevicesNetworkDialogAction->setText (tr ("&Network Adapters..."));
-    mDevicesNetworkDialogAction->setStatusTip (
-        tr ("Open the dialog to change settings of the Network Adapters"));
-
-    mDevicesSFDialogAction->setText (tr ("&Shared Folders..."));
-    mDevicesSFDialogAction->setStatusTip (
-        tr ("Open the dialog to operate on shared folders"));
-
-    mDevicesInstallGuestToolsAction->setText (VBoxGlobal::insertKeyToActionText (tr ("&Install Guest Additions..."),
-                                                                                 "D"));
-    mDevicesInstallGuestToolsAction->setStatusTip (
-        tr ("Mount the Guest Additions installation image"));
+    mDevicesSwitchVrdpAction->setStatusTip (tr ("Enable or disable remote desktop (RDP) connections to this machine"));
+#if 0 /* TODO: Allow to setup status-bar! */
+    mDevicesVRDPMenu->setToolTip (tr ("Remote Desktop (RDP) Server", "enable/disable..."));
+#endif
+
+    mDevicesInstallGuestToolsAction->setText (VBoxGlobal::insertKeyToActionText (tr ("&Install Guest Additions..."), "D"));
+    mDevicesInstallGuestToolsAction->setStatusTip (tr ("Mount the Guest Additions installation image"));
+
+    mDevicesUSBMenu->setTitle (tr ("&USB Devices"));
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
     /* Debug actions */
-
     if (mDbgStatisticsAction)
         mDbgStatisticsAction->setText (tr ("&Statistics...", "debug action"));
@@ -1772,22 +1634,14 @@
 
     /* Help actions */
-
     mHelpActions.retranslateUi();
 
-    /* Devices menu submenus */
-
-    mDevicesMountFloppyMenu->setTitle (tr ("Mount &Floppy"));
-    mDevicesMountDVDMenu->setTitle (tr ("Mount &CD/DVD-ROM"));
-    mDevicesUSBMenu->setTitle (tr ("&USB Devices"));
-
-    /* main menu & seamless popup menu */
-
+    /* Main menu & seamless popup menu */
     mVMMenu->setTitle (tr ("&Machine"));
-//    mVMMenu->setIcon (VBoxGlobal::iconSet (":/machine_16px.png"));
-
-    mMiniVMMenu->setTitle (tr ("&Machine"));
+    // mVMMenu->setIcon (VBoxGlobal::iconSet (":/machine_16px.png"));
+
+    mVMMenuMini->setTitle (tr ("&Machine"));
 
     mDevicesMenu->setTitle (tr ("&Devices"));
-//    mDevicesMenu->setIcon (VBoxGlobal::iconSet (":/settings_16px.png"));
+    // mDevicesMenu->setIcon (VBoxGlobal::iconSet (":/settings_16px.png"));
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
@@ -1796,15 +1650,8 @@
 #endif
     mHelpMenu->setTitle (tr ("&Help"));
-//    mHelpMenu->setIcon (VBoxGlobal::iconSet (":/help_16px.png"));
-
-    /* status bar widgets */
-
-#if 0
-    autoresize_state->setToolTip (
-        tr ("Indicates whether the guest display auto-resize function is On "
-            "(<img src=:/auto_resize_on_16px.png/>) or Off (<img src=:/auto_resize_off_16px.png/>). "
-            "Note that this function requires Guest Additions to be installed in the guest OS."));
-#endif
-    mouse_state->setToolTip (
+    // mHelpMenu->setIcon (VBoxGlobal::iconSet (":/help_16px.png"));
+
+    /* Status bar widgets */
+    mMouseLed->setToolTip (
         tr ("Indicates whether the host mouse pointer is captured by the guest OS:<br>"
             "<nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;pointer is not captured</nobr><br>"
@@ -1814,151 +1661,1078 @@
             "<nobr><img src=:/mouse_can_seamless_uncaptured_16px.png/>&nbsp;&nbsp;MI is Off, pointer is not captured</nobr><br>"
             "Note that the mouse integration feature requires Guest Additions to be installed in the guest OS."));
-    hostkey_state->setToolTip (
+    mHostkeyLed->setToolTip (
         tr ("Indicates whether the keyboard is captured by the guest OS "
             "(<img src=:/hostkey_captured_16px.png/>) or not (<img src=:/hostkey_16px.png/>)."));
-    hostkey_name->setToolTip (
+    mHostkeyName->setToolTip (
         tr ("Shows the currently assigned Host key.<br>"
             "This key, when pressed alone, toggles the keyboard and mouse "
             "capture state. It can also be used in combination with other keys "
             "to quickly perform actions from the main menu."));
-    hostkey_name->setText (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey()));
+    mHostkeyName->setText (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey()));
+
+#if 0 /* TODO: Allow to setup status-bar! */
+    mAutoresizeLed->setToolTip (
+        tr ("Indicates whether the guest display auto-resize function is On "
+            "(<img src=:/auto_resize_on_16px.png/>) or Off (<img src=:/auto_resize_off_16px.png/>). "
+            "Note that this function requires Guest Additions to be installed in the guest OS."));
+#endif
 
     updateAppearanceOf (AllStuff);
 }
 
-//
-// Private members
-/////////////////////////////////////////////////////////////////////////////
-
-void VBoxConsoleWnd::updateAppearanceOf (int element)
-{
-    if (!console) return;
-
-    CMachine cmachine = csession.GetMachine();
-    CConsole cconsole = console->console();
-
-    bool isRunningOrPaused = machine_state == KMachineState_Running ||
-                             machine_state == KMachineState_Paused;
-
-    if (element & Caption)
+void VBoxConsoleWnd::finalizeOpenView()
+{
+    LogFlowFuncEnter();
+
+    /* Notify the console scroll-view about the console-window is opened. */
+    mConsole->onViewOpened();
+
+    bool saved = mMachineState == KMachineState_Saved;
+
+    CMachine machine = mSession.GetMachine();
+    CConsole console = mConsole->console();
+
+    if (mIsFirstTimeStarted)
+    {
+        VBoxVMFirstRunWzd wzd (machine, this);
+        wzd.exec();
+
+        /* Remove GUI_FirstRun extra data key from the machine settings
+         * file after showing the wizard once. */
+        machine.SetExtraData (VBoxDefs::GUI_FirstRun, QString::null);
+    }
+
+    /* Start the VM */
+    CProgress progress = vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled() ?
+                         console.PowerUpPaused() : console.PowerUp();
+
+    /* Check for an immediate failure */
+    if (!console.isOk())
+    {
+        vboxProblem().cannotStartMachine (console);
+        /* close this window (this will call closeView()) */
+        close();
+
+        LogFlowFunc (("Error starting VM\n"));
+        LogFlowFuncLeave();
+        return;
+    }
+
+    mConsole->attach();
+
+    /* Disable auto closure because we want to have a chance to show the
+     * error dialog on startup failure */
+    mNoAutoClose = true;
+
+    /* show the "VM starting / restoring" progress dialog */
+
+    if (saved)
+        vboxProblem().showModalProgressDialog (progress, machine.GetName(), this, 0);
+    else
+        vboxProblem().showModalProgressDialog (progress, machine.GetName(), this);
+
+    if (progress.GetResultCode() != 0)
+    {
+        vboxProblem().cannotStartMachine (progress);
+        /* close this window (this will call closeView()) */
+        close();
+
+        LogFlowFunc (("Error starting VM\n"));
+        LogFlowFuncLeave();
+        return;
+    }
+
+    mNoAutoClose = false;
+
+    /* Check if we missed a really quick termination after successful
+     * startup, and process it if we did. */
+    if (mMachineState < KMachineState_Running)
+    {
+        close();
+        LogFlowFuncLeave();
+        return;
+    }
+
+    /* Currently the machine is started and the guest API could be used...
+     * Checking if the fullscreen mode should be activated */
+    QString str = machine.GetExtraData (VBoxDefs::GUI_Fullscreen);
+    if (str == "on")
+        mVmFullscreenAction->setChecked (true);
+
+    /* If seamless mode should be enabled then check if it is enabled
+     * currently and re-enable it if seamless is supported */
+    if (mVmSeamlessAction->isChecked() && mIsSeamlessSupported && mIsGraphicsSupported)
+        toggleFullscreenMode (true, true);
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /* Open the debugger in "full screen" mode requested by the user. */
+    else if (vboxGlobal().isDebuggerAutoShowEnabled())
+    {
+        /* console in upper left corner of the desktop. */
+        QRect rct (0, 0, 0, 0);
+        QDesktopWidget *desktop = QApplication::desktop();
+        if (desktop)
+            rct = desktop->availableGeometry(pos());
+        move (QPoint (rct.x(), rct.y()));
+
+        if (vboxGlobal().isDebuggerAutoShowStatisticsEnabled())
+            dbgShowStatistics();
+        if (vboxGlobal().isDebuggerAutoShowCommandLineEnabled())
+            dbgShowCommandLine();
+
+        if (!vboxGlobal().isStartPausedEnabled())
+            mConsole->pause (false);
+    }
+#endif
+
+    mIsOpenViewFinished = true;
+    LogFlowFuncLeave();
+
+#ifdef VBOX_WITH_UPDATE_REQUEST
+    vboxGlobal().showUpdateDialog (false /* aForce */);
+#endif
+
+    /* Finally check the status of required features. */
+    checkRequiredFeatures();
+
+    /* Re-request all the static values finally after
+     * view is really opened and attached. */
+    updateAppearanceOf (VirtualizationStuff);
+}
+
+/**
+ *  Helper to safely close the main console window.
+ *
+ *  This method ensures that close() will not be called if there is some
+ *  modal widget currently being executed, as it can cause uninitialization
+ *  at the point of code where it is not expected at all (example:
+ *  VBoxConsoleView::mouseEvent() calling
+ *  VBoxProblemReporter::confirmInputCapture()). Instead, an attempt to
+ *  close the current modal widget is done and tryClose() is rescheduled for
+ *  later execution using a single-shot zero timer.
+ *
+ *  In particular, this method is used by updateMachineState() when the VM
+ *  goes offline, which can even happen if we are inside the modal event loop,
+ *  (for example, the VM has been externally powered off or the guest OS
+ *  has initiated a shutdown procedure).
+ */
+void VBoxConsoleWnd::tryClose()
+{
+    /* First close any open modal & popup widgets. Use a single shot with
+     * timeout 0 to allow the widgets to cleany close and test then again. If
+     * all open widgets are closed destroy ourself. */
+    QWidget *widget = QApplication::activeModalWidget() ?
+                      QApplication::activeModalWidget() :
+                      QApplication::activePopupWidget() ?
+                      QApplication::activePopupWidget() : 0;
+    if (widget)
+    {
+        widget->close();
+        QTimer::singleShot (0, this, SLOT (tryClose()));
+    }
+    else
+        close();
+}
+
+void VBoxConsoleWnd::vmFullscreen (bool aOn)
+{
+    bool ok = toggleFullscreenMode (aOn, false /* aSeamless */);
+    if (!ok)
+    {
+        /* On failure, restore the previous button state */
+        mVmFullscreenAction->blockSignals (true);
+        mVmFullscreenAction->setChecked (!aOn);
+        mVmFullscreenAction->blockSignals (false);
+    }
+}
+
+void VBoxConsoleWnd::vmSeamless (bool aOn)
+{
+    /* Check if it is possible to enter/leave seamless mode */
+    if ((mIsSeamlessSupported && mIsGraphicsSupported) || !aOn)
+    {
+        bool ok = toggleFullscreenMode (aOn, true /* aSeamless */);
+        if (!ok)
+        {
+            /* On failure, restore the previous button state */
+            mVmSeamlessAction->blockSignals (true);
+            mVmSeamlessAction->setChecked (!aOn);
+            mVmSeamlessAction->blockSignals (false);
+        }
+    }
+}
+
+void VBoxConsoleWnd::vmAutoresizeGuest (bool on)
+{
+    if (!mConsole)
+        return;
+
+#if 0 /* TODO: Allow to setup status-bar! */
+    mAutoresizeLed->setState (on ? 3 : 1);
+#endif
+
+    mConsole->setAutoresizeGuest (on);
+}
+
+void VBoxConsoleWnd::vmAdjustWindow()
+{
+    if (mConsole)
+    {
+        if (isWindowMaximized())
+            showNormal();
+        mConsole->normalizeGeometry (true /* adjustPosition */);
+    }
+}
+
+void VBoxConsoleWnd::vmDisableMouseIntegration (bool aOff)
+{
+    if (mConsole)
+    {
+        mConsole->setMouseIntegrationEnabled (!aOff);
+        updateAppearanceOf (DisableMouseIntegrAction);
+    }
+}
+
+void VBoxConsoleWnd::vmTypeCAD()
+{
+    if (mConsole)
+    {
+        CKeyboard keyboard  = mConsole->console().GetKeyboard();
+        Assert (!keyboard.isNull());
+        keyboard.PutCAD();
+        AssertWrapperOk (keyboard);
+    }
+}
+
+#ifdef Q_WS_X11
+void VBoxConsoleWnd::vmTypeCABS()
+{
+    if (mConsole)
+    {
+        CKeyboard keyboard  = mConsole->console().GetKeyboard();
+        Assert (!keyboard.isNull());
+        static QVector <LONG> sSequence (6);
+        sSequence[0] = 0x1d; // Ctrl down
+        sSequence[1] = 0x38; // Alt down
+        sSequence[2] = 0x0E; // Backspace down
+        sSequence[3] = 0x8E; // Backspace up
+        sSequence[4] = 0xb8; // Alt up
+        sSequence[5] = 0x9d; // Ctrl up
+        keyboard.PutScancodes (sSequence);
+        AssertWrapperOk (keyboard);
+    }
+}
+#endif
+
+void VBoxConsoleWnd::vmTakeSnapshot()
+{
+    AssertReturn (mConsole, (void) 0);
+
+    /* remember the paused state */
+    bool wasPaused = mMachineState == KMachineState_Paused;
+    if (!wasPaused)
+    {
+        /* Suspend the VM and ignore the close event if failed to do so.
+         * pause() will show the error message to the user. */
+        if (!mConsole->pause (true))
+            return;
+    }
+
+    CMachine machine = mSession.GetMachine();
+
+    VBoxTakeSnapshotDlg dlg (this);
+
+    QString typeId = machine.GetOSTypeId();
+    dlg.mLbIcon->setPixmap (vboxGlobal().vmGuestOSTypeIcon (typeId));
+
+    /* search for the max available filter index */
+    int maxSnapShotIndex = 0;
+    QString snapShotName = tr ("Snapshot %1");
+    QRegExp regExp (QString ("^") + snapShotName.arg ("([0-9]+)") + QString ("$"));
+    CSnapshot index = machine.GetSnapshot (QString::null);
+    while (!index.isNull())
+    {
+        /* Check the current snapshot name */
+        QString name = index.GetName();
+        int pos = regExp.indexIn (name);
+        if (pos != -1)
+            maxSnapShotIndex = regExp.cap (1).toInt() > maxSnapShotIndex ?
+                               regExp.cap (1).toInt() : maxSnapShotIndex;
+        /* Traversing to the next child */
+        CSnapshotVector c = index.GetChildren();
+        if (c.size() > 0)
+            index = c [0];
+        else
+            break;
+    }
+    dlg.mLeName->setText (snapShotName.arg (maxSnapShotIndex + 1));
+
+    if (dlg.exec() == QDialog::Accepted)
+    {
+        CConsole console = mSession.GetConsole();
+
+        CProgress progress = console.TakeSnapshot (dlg.mLeName->text().trimmed(), dlg.mTeDescription->toPlainText());
+
+        if (console.isOk())
+        {
+            /* Show the "Taking Snapshot" progress dialog */
+            vboxProblem().showModalProgressDialog (progress, machine.GetName(), this, 0);
+
+            if (progress.GetResultCode() != 0)
+                vboxProblem().cannotTakeSnapshot (progress);
+        }
+        else
+            vboxProblem().cannotTakeSnapshot (console);
+    }
+
+    /* Restore the running state if needed */
+    if (!wasPaused)
+        mConsole->pause (false);
+}
+
+void VBoxConsoleWnd::vmShowInfoDialog()
+{
+    VBoxVMInformationDlg::createInformationDlg (mSession, mConsole);
+}
+
+void VBoxConsoleWnd::vmReset()
+{
+    if (mConsole)
+    {
+        if (vboxProblem().confirmVMReset (this))
+            mConsole->console().Reset();
+    }
+}
+
+void VBoxConsoleWnd::vmPause (bool aOn)
+{
+    if (mConsole)
+    {
+        mConsole->pause (aOn);
+        updateAppearanceOf (PauseAction);
+    }
+}
+
+void VBoxConsoleWnd::vmACPIShutdown()
+{
+    if (!mSession.GetConsole().GetGuestEnteredACPIMode())
+        return vboxProblem().cannotSendACPIToMachine();
+
+    if (mConsole)
+    {
+        CConsole console = mConsole->console();
+        console.PowerButton();
+        if (!console.isOk())
+            vboxProblem().cannotACPIShutdownMachine (console);
+    }
+}
+
+void VBoxConsoleWnd::vmClose()
+{
+    if (mConsole)
+        close();
+}
+
+void VBoxConsoleWnd::devicesSwitchVrdp (bool aOn)
+{
+    if (!mConsole) return;
+
+    CVRDPServer vrdpServer = mSession.GetMachine().GetVRDPServer();
+    /* This method should not be executed if vrdpServer is null */
+    Assert (!vrdpServer.isNull());
+
+    vrdpServer.SetEnabled (aOn);
+    updateAppearanceOf (VRDPStuff);
+}
+
+void VBoxConsoleWnd::devicesOpenStorageDialog()
+{
+    if (!mConsole) return;
+
+    VBoxStorageDialog dlg (mConsole, mSession);
+    dlg.exec();
+}
+
+void VBoxConsoleWnd::devicesOpenNetworkDialog()
+{
+    if (!mConsole) return;
+
+    VBoxNetworkDialog dlg (mConsole, mSession);
+    dlg.exec();
+}
+
+void VBoxConsoleWnd::devicesOpenSFDialog()
+{
+    if (!mConsole) return;
+
+    VBoxSFDialog dlg (mConsole, mSession);
+    dlg.exec();
+}
+
+void VBoxConsoleWnd::devicesInstallGuestAdditions()
+{
+    char szAppPrivPath [RTPATH_MAX];
+    int rc = RTPathAppPrivateNoArch (szAppPrivPath, sizeof (szAppPrivPath));
+    AssertRC (rc);
+
+    QString src1 = QString (szAppPrivPath) + "/VBoxGuestAdditions.iso";
+    QString src2 = qApp->applicationDirPath() + "/additions/VBoxGuestAdditions.iso";
+
+    /* Check the standard image locations */
+    if (QFile::exists (src1))
+        return installGuestAdditionsFrom (src1);
+    else if (QFile::exists (src2))
+        return installGuestAdditionsFrom (src2);
+
+    /* Check for the already registered image */
+    CVirtualBox vbox = vboxGlobal().virtualBox();
+    QString name = QString ("VBoxGuestAdditions_%1.iso").arg (vbox.GetVersion().remove ("_OSE"));
+
+    CMediumVector vec = vbox.GetDVDImages();
+    for (CMediumVector::ConstIterator it = vec.begin(); it != vec.end(); ++ it)
+    {
+        QString path = it->GetLocation();
+        /* Compare the name part ignoring the file case */
+        QString fn = QFileInfo (path).fileName();
+        if (RTPathCompare (name.toUtf8().constData(), fn.toUtf8().constData()) == 0)
+            return installGuestAdditionsFrom (path);
+    }
+
+    /* Download the required image */
+    int result = vboxProblem().cannotFindGuestAdditions (
+        QDir::toNativeSeparators (src1), QDir::toNativeSeparators (src2));
+    if (result == QIMessageBox::Yes)
+    {
+        QString source = QString ("http://download.virtualbox.org/virtualbox/%1/")
+                                  .arg (vbox.GetVersion().remove ("_OSE")) + name;
+        QString target = QDir (vboxGlobal().virtualBox().GetHomeFolder())
+                               .absoluteFilePath (name);
+
+        VBoxAdditionsDownloader *dl =
+            new VBoxAdditionsDownloader (source, target, mDevicesInstallGuestToolsAction);
+        statusBar()->addWidget (dl, 0);
+        dl->start();
+    }
+}
+
+void VBoxConsoleWnd::prepareStorageMenu()
+{
+    mDevicesStorageMenu->clear();
+    mDevicesStorageMenu->addAction (mDevicesStorageDialogAction);
+}
+
+void VBoxConsoleWnd::prepareNetworkMenu()
+{
+    mDevicesNetworkMenu->clear();
+    mDevicesNetworkMenu->addAction (mDevicesNetworkDialogAction);
+}
+
+void VBoxConsoleWnd::prepareSFMenu()
+{
+    mDevicesSFMenu->clear();
+    mDevicesSFMenu->addAction (mDevicesSFDialogAction);
+}
+
+/**
+ *  Attach/Detach selected USB Device.
+ */
+void VBoxConsoleWnd::switchUSB (QAction *aAction)
+{
+    if (!mConsole) return;
+
+    CConsole console = mSession.GetConsole();
+    AssertWrapperOk (mSession);
+
+    CUSBDevice usb = mDevicesUSBMenu->getUSB (aAction);
+    /* if null then some other item but a USB device is selected */
+    if (usb.isNull())
+        return;
+
+    if (!aAction->isChecked())
+    {
+        console.DetachUSBDevice (usb.GetId());
+        if (!console.isOk())
+        {
+            /// @todo (r=dmik) the dialog should be either modeless
+            //  or we have to pause the VM
+            vboxProblem().cannotDetachUSBDevice (console, vboxGlobal().details (usb));
+        }
+    }
+    else
+    {
+        console.AttachUSBDevice (usb.GetId());
+        if (!console.isOk())
+        {
+            /// @todo (r=dmik) the dialog should be either modeless
+            //  or we have to pause the VM
+            vboxProblem().cannotAttachUSBDevice (console, vboxGlobal().details (usb));
+        }
+    }
+}
+
+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 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);
+        }
+    }
+#endif
+    else if (aInd == mNetLed)
+    {
+        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)
+    {
+        mVmDisMouseIntegrMenu->exec (aEvent->globalPos());
+    }
+#if 0 /* TODO: Allow to setup status-bar! */
+    else if (aInd == mVrdpLed)
+    {
+        mDevicesVRDPMenu->exec (aEvent->globalPos());
+    }
+    else if (aInd == mAutoresizeLed)
+    {
+        mVmAutoresizeMenu->exec (aEvent->globalPos());
+    }
+#endif
+}
+
+void VBoxConsoleWnd::updateDeviceLights()
+{
+    if (mConsole)
+    {
+        CConsole &console = mConsole->console();
+        int st;
+        if (mHDLed->state() != KDeviceActivity_Null)
+        {
+            st = console.GetDeviceActivity (KDeviceType_HardDisk);
+            if (mHDLed->state() != st)
+                mHDLed->setState (st);
+        }
+        if (mCDLed->state() != KDeviceActivity_Null)
+        {
+            st = console.GetDeviceActivity (KDeviceType_DVD);
+            if (mCDLed->state() != st)
+                mCDLed->setState (st);
+        }
+#if 0 /* TODO: Allow to setup status-bar! */
+        if (mFDLed->state() != KDeviceActivity_Null)
+        {
+            st = console.GetDeviceActivity (KDeviceType_Floppy);
+            if (mFDLed->state() != st)
+                mFDLed->setState (st);
+        }
+#endif
+        if (mNetLed->state() != KDeviceActivity_Null)
+        {
+            st = console.GetDeviceActivity (KDeviceType_Network);
+            if (mNetLed->state() != st)
+                mNetLed->setState (st);
+        }
+        if (mUSBLed->state() != KDeviceActivity_Null)
+        {
+            st = console.GetDeviceActivity (KDeviceType_USB);
+            if (mUSBLed->state() != st)
+                mUSBLed->setState (st);
+        }
+        if (mSFLed->state() != KDeviceActivity_Null)
+        {
+            st = console.GetDeviceActivity (KDeviceType_SharedFolder);
+            if (mSFLed->state() != st)
+                mSFLed->setState (st);
+        }
+    }
+}
+
+void VBoxConsoleWnd::updateMachineState (KMachineState aState)
+{
+    bool guruMeditation = false;
+
+    if (mConsole && mMachineState != aState)
+    {
+        if (aState >= KMachineState_Running)
+        {
+            switch (aState)
+            {
+                case KMachineState_Stuck:
+                {
+                    guruMeditation = true;
+                    break;
+                }
+                case KMachineState_Paused:
+                {
+                    if (!mVmPauseAction->isChecked())
+                        mVmPauseAction->setChecked (true);
+                    break;
+                }
+                case KMachineState_Running:
+                {
+                    if (mMachineState == KMachineState_Paused && mVmPauseAction->isChecked())
+                        mVmPauseAction->setChecked (false);
+                    break;
+                }
+#ifdef Q_WS_X11
+                case KMachineState_Starting:
+                {
+                    /* The keyboard handler may wish to do some release logging
+                       on startup.  Tell it that the logger is now active. */
+                    doXKeyboardLogging (QX11Info::display());
+                    break;
+                }
+#endif
+                default:
+                    break;
+            }
+        }
+
+        bool isRunningOrPaused = aState == KMachineState_Running || aState == KMachineState_Paused;
+
+        /* Enable/Disable actions that are not managed by updateAppearanceOf() */
+
+        mRunningActions->setEnabled (aState == KMachineState_Running);
+        mRunningOrPausedActions->setEnabled (isRunningOrPaused);
+
+        mMachineState = aState;
+
+        updateAppearanceOf (Caption |
+                            HardDiskStuff | DVDStuff | FloppyStuff |
+                            NetworkStuff | USBStuff | VRDPStuff |
+                            PauseAction | DisableMouseIntegrAction);
+
+        if (aState < KMachineState_Running)
+        {
+            /* VM has been powered off or saved or aborted, no matter
+             * internally or externally -- we must *safely* close the console
+             * window unless auto closure is disabled. */
+            if (!mNoAutoClose)
+                tryClose();
+        }
+    }
+
+    if (guruMeditation)
+    {
+        CConsole console = mConsole->console();
+        QString logFolder = console.GetMachine().GetLogFolder();
+
+        /* Take the screenshot for debugging purposes and save it */
+        QString fname = logFolder + "/VBox.png";
+
+        CDisplay dsp = console.GetDisplay();
+        QImage shot = QImage (dsp.GetWidth(), dsp.GetHeight(), QImage::Format_RGB32);
+        dsp.TakeScreenShot (shot.bits(), shot.width(), shot.height());
+        shot.save (QFile::encodeName (fname), "PNG");
+
+        if (vboxProblem().remindAboutGuruMeditation (console, QDir::toNativeSeparators (logFolder)))
+        {
+            qApp->processEvents();
+            console.PowerDown();
+            if (!console.isOk())
+                vboxProblem().cannotStopMachine (console);
+        }
+    }
+
+#ifdef Q_WS_MAC
+    if (mConsole)
+        mConsole->updateDockOverlay();
+#endif
+}
+
+void VBoxConsoleWnd::updateMouseState (int aState)
+{
+    mVmDisableMouseIntegrAction->setEnabled (aState & VBoxConsoleView::MouseAbsolute);
+
+    if ((aState & VBoxConsoleView::MouseAbsoluteDisabled) &&
+        (aState & VBoxConsoleView::MouseAbsolute) &&
+        !(aState & VBoxConsoleView::MouseCaptured))
+    {
+        mMouseLed->setState (4);
+    }
+    else
+    {
+        mMouseLed->setState (aState & (VBoxConsoleView::MouseAbsolute | VBoxConsoleView::MouseCaptured));
+    }
+}
+
+void VBoxConsoleWnd::updateAdditionsState (const QString &aVersion,
+                                           bool aActive,
+                                           bool aSeamlessSupported,
+                                           bool aGraphicsSupported)
+{
+    mVmAutoresizeGuestAction->setEnabled (aActive && aGraphicsSupported);
+    if ((mIsSeamlessSupported != aSeamlessSupported) ||
+        (mIsGraphicsSupported != aGraphicsSupported))
+    {
+        mVmSeamlessAction->setEnabled (aSeamlessSupported && aGraphicsSupported);
+        mIsSeamlessSupported = aSeamlessSupported;
+        mIsGraphicsSupported = aGraphicsSupported;
+        /* If seamless mode should be enabled then check if it is enabled
+         * currently and re-enable it if open-view procedure is finished */
+        if (mVmSeamlessAction->isChecked() && mIsOpenViewFinished && aSeamlessSupported && aGraphicsSupported)
+            toggleFullscreenMode (true, true);
+        /* Disable auto-resizing if advanced graphics are not available */
+        mConsole->setAutoresizeGuest (mIsGraphicsSupported && mVmAutoresizeGuestAction->isChecked());
+        mVmAutoresizeGuestAction->setEnabled (mIsGraphicsSupported);
+    }
+
+    /* Check the GA version only in case of additions are active */
+    if (!aActive)
+        return;
+
+    /* Check the Guest Additions version and warn the user about possible
+     * compatibility issues in case if the installed version is outdated. */
+    uint version = aVersion.toUInt();
+    QString versionStr = QString ("%1.%2")
+        .arg (RT_HIWORD (version)).arg (RT_LOWORD (version));
+    QString expectedStr = QString ("%1.%2")
+        .arg (VMMDEV_VERSION_MAJOR).arg (VMMDEV_VERSION_MINOR); /** @todo r=bird: This isn't want we want! We want the VirtualBox version of the additions, all three numbers. See @bugref{4084}.*/
+
+    if (RT_HIWORD (version) < VMMDEV_VERSION_MAJOR)
+    {
+        vboxProblem().warnAboutTooOldAdditions (this, versionStr, expectedStr);
+    }
+    else if (RT_HIWORD (version) == VMMDEV_VERSION_MAJOR &&
+             RT_LOWORD (version) <  VMMDEV_VERSION_MINOR)
+    {
+        vboxProblem().warnAboutOldAdditions (this, versionStr, expectedStr);
+    }
+    else if (version > VMMDEV_VERSION)
+    {
+        vboxProblem().warnAboutNewAdditions (this, versionStr, expectedStr);
+    }
+}
+
+void VBoxConsoleWnd::updateNetworkAdaptersState()
+{
+    updateAppearanceOf (NetworkStuff);
+}
+
+void VBoxConsoleWnd::updateUsbState()
+{
+    updateAppearanceOf (USBStuff);
+}
+
+void VBoxConsoleWnd::updateMediaDriveState (VBoxDefs::MediumType aType)
+{
+    Assert (aType == VBoxDefs::MediumType_DVD || aType == VBoxDefs::MediumType_Floppy);
+    updateAppearanceOf (aType == VBoxDefs::MediumType_DVD ? DVDStuff :
+                        aType == VBoxDefs::MediumType_Floppy ? FloppyStuff :
+                        AllStuff);
+}
+
+void VBoxConsoleWnd::updateSharedFoldersState()
+{
+    updateAppearanceOf (SharedFolderStuff);
+}
+
+/**
+ *  This slot is called just after leaving the fullscreen/seamless mode,
+ *  when the console was resized to previous size.
+ */
+void VBoxConsoleWnd::onExitFullscreen()
+{
+    mConsole->setIgnoreMainwndResize (false);
+}
+
+void VBoxConsoleWnd::unlockActionsSwitch()
+{
+    if (mIsSeamless)
+        mVmSeamlessAction->setEnabled (true);
+    else if (mIsFullscreen)
+        mVmFullscreenAction->setEnabled (true);
+    else
+    {
+        mVmSeamlessAction->setEnabled (mIsSeamlessSupported && mIsGraphicsSupported);
+        mVmFullscreenAction->setEnabled (true);
+    }
+
+#ifdef Q_WS_MAC
+    if (!mIsSeamless)
+    {
+        /* Fade back to the normal gamma */
+        CGDisplayFade (mFadeToken, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, false);
+        CGReleaseDisplayFadeReservation (mFadeToken);
+    }
+    mConsole->setMouseCoalescingEnabled (true);
+#endif
+}
+
+void VBoxConsoleWnd::mtExitMode()
+{
+    if (mIsSeamless)
+        mVmSeamlessAction->toggle();
+    else
+        mVmFullscreenAction->toggle();
+}
+
+void VBoxConsoleWnd::mtCloseVM()
+{
+    mVmCloseAction->trigger();
+}
+
+void VBoxConsoleWnd::mtMaskUpdate()
+{
+    if (mIsSeamless)
+        setMask (mConsole->lastVisibleRegion());
+}
+
+void VBoxConsoleWnd::changeDockIconUpdate (const VBoxChangeDockIconUpdateEvent &aEvent)
+{
+#ifdef Q_WS_MAC
+    if (mConsole)
+    {
+        mConsole->setDockIconEnabled (aEvent.mChanged);
+        mConsole->updateDockOverlay();
+    }
+#else
+    Q_UNUSED (aEvent);
+#endif
+}
+
+/**
+ *  Called (on non-UI thread!) when a global GUI setting changes.
+ */
+void VBoxConsoleWnd::processGlobalSettingChange (const char * /* aPublicName */, const char * /* aName */)
+{
+    mHostkeyName->setText (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey()));
+}
+
+/**
+ *  This function checks the status of required features and
+ *  makes a warning and/or some action if something necessary
+ *  is not in good condition.
+ *  Does nothing if no console view was opened.
+ */
+void VBoxConsoleWnd::checkRequiredFeatures()
+{
+    if (!mConsole) return;
+
+    CConsole console = mConsole->console();
+
+    /* Check if the virtualization feature is required. */
+    bool is64BitsGuest    = vboxGlobal().virtualBox().GetGuestOSType (
+                            console.GetGuest().GetOSTypeId()).GetIs64Bit();
+    bool fRecommendVirtEx = vboxGlobal().virtualBox().GetGuestOSType (
+                            console.GetGuest().GetOSTypeId()).GetRecommendedVirtEx();
+    Assert(!is64BitsGuest || fRecommendVirtEx);
+    bool isVirtEnabled    = console.GetDebugger().GetHWVirtExEnabled();
+    if (fRecommendVirtEx && !isVirtEnabled)
+    {
+        bool ret;
+
+        vmPause (true);
+
+        if (is64BitsGuest)
+            ret = vboxProblem().warnAboutVirtNotEnabled64BitsGuest();
+        else
+            ret = vboxProblem().warnAboutVirtNotEnabledGuestRequired();
+
+        if (ret == true)
+            close();
+        else
+            vmPause (false);
+    }
+}
+
+void VBoxConsoleWnd::activateUICustomizations()
+{
+    VBoxGlobalSettings settings = vboxGlobal().settings();
+    /* Process known keys */
+    menuBar()->setHidden (settings.isFeatureActive ("noMenuBar"));
+    statusBar()->setHidden (settings.isFeatureActive ("noStatusBar"));
+}
+
+void VBoxConsoleWnd::updateAppearanceOf (int aElement)
+{
+    if (!mConsole) return;
+
+    CMachine machine = mSession.GetMachine();
+    CConsole console = mConsole->console();
+
+    bool isRunningOrPaused = mMachineState == KMachineState_Running || mMachineState == KMachineState_Paused;
+
+    if (aElement & Caption)
     {
         QString snapshotName;
-        if (cmachine.GetSnapshotCount() > 0)
-        {
-            CSnapshot snapshot = cmachine.GetCurrentSnapshot();
+        if (machine.GetSnapshotCount() > 0)
+        {
+            CSnapshot snapshot = machine.GetCurrentSnapshot();
             snapshotName = " (" + snapshot.GetName() + ")";
         }
-        setWindowTitle (cmachine.GetName() + snapshotName +
-                        " [" + vboxGlobal().toString (machine_state) + "] - " +
-                        caption_prefix);
-        mMiniToolBar->setDisplayText (cmachine.GetName() + snapshotName);
-//#ifdef Q_WS_MAC
-//        SetWindowTitleWithCFString (reinterpret_cast <WindowPtr> (this->winId()), CFSTR("sfds"));
-//SetWindowAlternateTitle
-//#endif
-    }
-    if (element & FloppyStuff)
-    {
-        mDevicesMountFloppyMenu->setEnabled (isRunningOrPaused);
-        CMedium floppy = cmachine.GetMedium("Floppy Controller", 0, 0);
-        bool mounted = !floppy.isNull();
-        mDevicesUnmountFloppyAction->setEnabled (isRunningOrPaused && mounted);
-        fd_light->setState (mounted ? KDeviceActivity_Idle : KDeviceActivity_Null);
-        QString tip = tr ("<qt><nobr>Indicates the activity of the floppy media:</nobr>"
-                          "%1</qt>",
-                          "Floppy tooltip");
-#if 0
-        /// @todo MEDIUM resurrect host dvd/floppy stuff deleted in r51247
-#endif
-        QString name;
-        if (mounted)
-            name = tr ("<br><nobr><b>Image</b>: %1</nobr>",
-                       "Floppy tooltip")
-                .arg (QDir::toNativeSeparators (floppy.GetLocation()));
-        else
-            name = tr ("<br><nobr><b>No media mounted</b></nobr>",
-                       "Floppy tooltip");
-        fd_light->setToolTip (tip.arg (name));
-    }
-    if (element & DVDStuff)
-    {
-        mDevicesMountDVDMenu->setEnabled (isRunningOrPaused);
-        CMedium dvd = cmachine.GetMedium("IDE Controller", 1, 0);
-        bool mounted = !dvd.isNull();
-        mDevicesUnmountDVDAction->setEnabled (isRunningOrPaused && mounted);
-        cd_light->setState (mounted ? KDeviceActivity_Idle : KDeviceActivity_Null);
-        QString tip = tr ("<qt><nobr>Indicates the activity of the CD/DVD-ROM media:</nobr>"
-                          "%1</qt>",
-                          "DVD-ROM tooltip");
-#if 0
-        /// @todo MEDIUM resurrect host dvd/floppy stuff deleted in r51247
-#endif
-        QString name;
-        if (mounted)
-            name = tr ("<br><nobr><b>Image</b>: %1</nobr>",
-                       "DVD-ROM tooltip")
-                .arg (QDir::toNativeSeparators (dvd.GetLocation()));
-        else
-            name = tr ("<br><nobr><b>No media mounted</b></nobr>",
-                       "DVD-ROM tooltip");
-        cd_light->setToolTip (tip.arg (name));
-    }
-    if (element & HardDiskStuff)
-    {
-        QString tip = tr ("<qt><nobr>Indicates the activity of virtual hard disks:</nobr>"
-                          "%1</qt>",
-                          "HDD tooltip");
+        setWindowTitle (machine.GetName() + snapshotName +
+                        " [" + vboxGlobal().toString (mMachineState) + "] - " +
+                        mCaptionPrefix);
+        mMiniToolBar->setDisplayText (machine.GetName() + snapshotName);
+    }
+    if (aElement & HardDiskStuff)
+    {
+        QString tip = tr ("<p style='white-space:pre'><nobr>Indicates the activity "
+                          "of virtual hard disks:</nobr>%1</p>", "HDD tooltip");
         QString data;
-        bool hasDisks = false;
-        CMediumAttachmentVector vec = cmachine.GetMediumAttachments();
-        for (CMediumAttachmentVector::ConstIterator hda = vec.begin();
-             hda != vec.end(); ++ hda)
-        {
-            if (hda->GetType() != KDeviceType_HardDisk)
-                continue;
-
-            CMedium hd = hda->GetMedium();
-            const QString ctlName = hda->GetController();
-            CStorageController ctl = cmachine.GetStorageControllerByName(ctlName);
-
-            data += QString ("<br><nobr><b>%1</b>:&nbsp;%2</nobr>")
-                .arg (vboxGlobal().toString (StorageSlot (ctl.GetBus(), hda->GetPort(), hda->GetDevice())))
-                .arg (QDir::convertSeparators (hd.GetLocation()));
-            hasDisks = true;
-        }
-        if (!hasDisks)
-            data += tr ("<br><nobr><b>No hard disks attached</b></nobr>",
-                        "HDD tooltip");
-        hd_light->setToolTip (tip.arg (data));
-        hd_light->setState (hasDisks ? KDeviceActivity_Idle : KDeviceActivity_Null);
-    }
-    if (element & NetworkStuff)
-    {
-        ulong maxCount = vboxGlobal().virtualBox()
-                        .GetSystemProperties().GetNetworkAdapterCount();
+        bool attachmentsPresent = false;
+
+        CStorageControllerVector controllers = machine.GetStorageControllers();
+        foreach (const CStorageController &controller, controllers)
+        {
+            QString attData;
+            CMediumAttachmentVector attachments = machine.GetMediumAttachmentsOfController (controller.GetName());
+            foreach (const CMediumAttachment &attachment, attachments)
+            {
+                if (attachment.GetType() != KDeviceType_HardDisk)
+                    continue;
+                attData += QString ("<br>&nbsp;<nobr>%1:&nbsp;%2</nobr>")
+                    .arg (vboxGlobal().toString (StorageSlot (controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
+                    .arg (vboxGlobal().findMedium (attachment.GetMedium().GetId()).location());
+                attachmentsPresent = true;
+            }
+            if (!attData.isNull())
+                data += QString ("<br><nobr><b>%1</b></nobr>").arg (controller.GetName()) + attData;
+        }
+
+        if (!attachmentsPresent)
+            data += tr ("<br><nobr><b>No hard disks attached</b></nobr>", "HDD tooltip");
+
+        mHDLed->setToolTip (tip.arg (data));
+        mHDLed->setState (attachmentsPresent ? KDeviceActivity_Idle : KDeviceActivity_Null);
+    }
+    if (aElement & DVDStuff)
+    {
+        QString tip = tr ("<p style='white-space:pre'><nobr>Indicates the activity "
+                          "of the CD/DVD devices:</nobr>%1</p>", "CD/DVD tooltip");
+        QString data;
+        bool attachmentsPresent = false;
+
+        CStorageControllerVector controllers = machine.GetStorageControllers();
+        foreach (const CStorageController &controller, controllers)
+        {
+            QString attData;
+            CMediumAttachmentVector attachments = machine.GetMediumAttachmentsOfController (controller.GetName());
+            foreach (const CMediumAttachment &attachment, attachments)
+            {
+                if (attachment.GetType() != KDeviceType_DVD)
+                    continue;
+                QString id (attachment.GetMedium().isNull() ? QString() : attachment.GetMedium().GetId());
+                VBoxMedium vboxMedium = vboxGlobal().findMedium (id);
+                attData += QString ("<br>&nbsp;<nobr>%1:&nbsp;%2</nobr>")
+                    .arg (vboxGlobal().toString (StorageSlot (controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
+                    .arg (vboxMedium.isNull() || vboxMedium.isHostDrive() ? vboxMedium.name() : vboxMedium.location());
+                attachmentsPresent = true;
+            }
+            if (!attData.isNull())
+                data += QString ("<br><nobr><b>%1</b></nobr>").arg (controller.GetName()) + attData;
+        }
+
+        if (!attachmentsPresent)
+            data += tr ("<br><nobr><b>No CD/DVD devices attached</b></nobr>", "CD/DVD tooltip");
+
+        mCDLed->setToolTip (tip.arg (data));
+        mCDLed->setState (attachmentsPresent ? KDeviceActivity_Idle : KDeviceActivity_Null);
+    }
+#if 0 /* TODO: Allow to setup status-bar! */
+    if (aElement & FloppyStuff)
+    {
+        QString tip = tr ("<p style='white-space:pre'><nobr>Indicates the activity "
+                          "of the floppy devices:</nobr>%1</p>", "FD tooltip");
+        QString data;
+        bool attachmentsPresent = false;
+
+        CStorageControllerVector controllers = machine.GetStorageControllers();
+        foreach (const CStorageController &controller, controllers)
+        {
+            QString attData;
+            CMediumAttachmentVector attachments = machine.GetMediumAttachmentsOfController (controller.GetName());
+            foreach (const CMediumAttachment &attachment, attachments)
+            {
+                if (attachment.GetType() != KDeviceType_Floppy)
+                    continue;
+                QString id (attachment.GetMedium().isNull() ? QString() : attachment.GetMedium().GetId());
+                VBoxMedium vboxMedium = vboxGlobal().findMedium (id);
+                attData += QString ("<br>&nbsp;<nobr>%1:&nbsp;%2</nobr>")
+                    .arg (vboxGlobal().toString (StorageSlot (controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
+                    .arg (vboxMedium.isNull() || vboxMedium.isHostDrive() ? vboxMedium.name() : vboxMedium.location());
+                attachmentsPresent = true;
+            }
+            if (!attData.isNull())
+                data += QString ("<br><nobr><b>%1</b></nobr>").arg (controller.GetName()) + attData;
+        }
+
+        if (!attachmentsPresent)
+            data += tr ("<br><nobr><b>No floppy devices attached</b></nobr>", "FD tooltip");
+
+        mFDLed->setToolTip (tip.arg (data));
+        mFDLed->setState (attachmentsPresent ? KDeviceActivity_Idle : KDeviceActivity_Null);
+    }
+#endif
+    if (aElement & NetworkStuff)
+    {
+        ulong maxCount = vboxGlobal().virtualBox().GetSystemProperties().GetNetworkAdapterCount();
         ulong count = 0;
-        for (ulong slot = 0; slot < maxCount; slot++)
-            if (cmachine.GetNetworkAdapter (slot).GetEnabled())
-                count++;
-        net_light->setState (count > 0 ? KDeviceActivity_Idle
-                                       : KDeviceActivity_Null);
+        for (ulong slot = 0; slot < maxCount; ++ slot)
+            if (machine.GetNetworkAdapter (slot).GetEnabled())
+                ++ count;
+        mNetLed->setState (count > 0 ? KDeviceActivity_Idle : KDeviceActivity_Null);
 
         mDevicesNetworkDialogAction->setEnabled (isRunningOrPaused && count > 0);
         mDevicesNetworkMenu->setEnabled (isRunningOrPaused && count > 0);
 
-        /* update tooltip */
-        QString ttip = tr ("<qt><nobr>Indicates the activity of the network "
-                           "interfaces:</nobr>"
-                           "%1</qt>",
-                           "Network adapters tooltip");
+        QString tip = tr ("<p style='white-space:pre'><nobr>Indicates the activity of the "
+                           "network interfaces:</nobr>%1</p>", "Network adapters tooltip");
         QString info;
 
         for (ulong slot = 0; slot < maxCount; ++ slot)
         {
-            CNetworkAdapter adapter = cmachine.GetNetworkAdapter (slot);
+            CNetworkAdapter adapter = machine.GetNetworkAdapter (slot);
             if (adapter.GetEnabled())
-                info += tr ("<br><nobr><b>Adapter %1 (%2)</b>: cable %3</nobr>",
-                            "Network adapters tooltip")
-                    .arg (slot+1)
+                info += tr ("<br><nobr><b>Adapter %1 (%2)</b>: cable %3</nobr>", "Network adapters tooltip")
+                    .arg (slot + 1)
                     .arg (vboxGlobal().toString (adapter.GetAttachmentType()))
                     .arg (adapter.GetCableConnected() ?
@@ -1968,51 +2742,42 @@
 
         if (info.isNull())
-            info = tr ("<br><nobr><b>All network adapters are disabled</b></nobr>",
-                       "Network adapters tooltip");
-
-        net_light->setToolTip (ttip.arg (info));
-    }
-    if (element & USBStuff)
-    {
-        if (!usb_light->isHidden())
-        {
-            /* update tooltip */
-            QString ttip = tr ("<qt><nobr>Indicates the activity of the "
-                               "attached USB devices:</nobr>"
-                               "%1</qt>",
-                               "USB device tooltip");
+            info = tr ("<br><nobr><b>All network adapters are disabled</b></nobr>", "Network adapters tooltip");
+
+        mNetLed->setToolTip (tip.arg (info));
+    }
+    if (aElement & USBStuff)
+    {
+        if (!mUSBLed->isHidden())
+        {
+            QString tip = tr ("<p style='white-space:pre'><nobr>Indicates the activity of "
+                              "the attached USB devices:</nobr>%1</p>", "USB device tooltip");
             QString info;
 
-            CUSBController usbctl = cmachine.GetUSBController();
-            if (    !usbctl.isNull()
-                &&  usbctl.GetEnabled())
+            CUSBController usbctl = machine.GetUSBController();
+            if (!usbctl.isNull() && usbctl.GetEnabled())
             {
                 mDevicesUSBMenu->setEnabled (isRunningOrPaused);
 
-                CUSBDeviceVector devsvec = cconsole.GetUSBDevices();
-                for (int i = 0; i < devsvec.size(); ++i)
+                CUSBDeviceVector devsvec = console.GetUSBDevices();
+                for (int i = 0; i < devsvec.size(); ++ i)
                 {
-                    CUSBDevice usb = devsvec[i];
-                    info += QString ("<br><b><nobr>%1</nobr></b>")
-                                     .arg (vboxGlobal().details (usb));
+                    CUSBDevice usb = devsvec [i];
+                    info += QString ("<br><b><nobr>%1</nobr></b>").arg (vboxGlobal().details (usb));
                 }
                 if (info.isNull())
-                    info = tr ("<br><nobr><b>No USB devices attached</b></nobr>",
-                               "USB device tooltip");
+                    info = tr ("<br><nobr><b>No USB devices attached</b></nobr>", "USB device tooltip");
             }
             else
             {
                 mDevicesUSBMenu->setEnabled (false);
-
-                info = tr ("<br><nobr><b>USB Controller is disabled</b></nobr>",
-                           "USB device tooltip");
+                info = tr ("<br><nobr><b>USB Controller is disabled</b></nobr>", "USB device tooltip");
             }
 
-            usb_light->setToolTip (ttip.arg (info));
-        }
-    }
-    if (element & VRDPStuff)
-    {
-        CVRDPServer vrdpsrv = csession.GetMachine().GetVRDPServer();
+            mUSBLed->setToolTip (tip.arg (info));
+        }
+    }
+    if (aElement & VRDPStuff)
+    {
+        CVRDPServer vrdpsrv = mSession.GetMachine().GetVRDPServer();
         if (!vrdpsrv.isNull())
         {
@@ -2020,23 +2785,20 @@
             bool isVRDPEnabled = vrdpsrv.GetEnabled();
             mDevicesSwitchVrdpAction->setChecked (isVRDPEnabled);
-#if 0
-            vrdp_state->setState (isVRDPEnabled ? 1 : 0);
-
-            /* compose status icon tooltip */
+#if 0 /* TODO: Allow to setup status-bar! */
+            mVrdpLed->setState (isVRDPEnabled ? 1 : 0);
+
             QString tip = tr ("Indicates whether the Remote Display (VRDP Server) "
                               "is enabled (<img src=:/vrdp_16px.png/>) or not "
-                              "(<img src=:/vrdp_disabled_16px.png/>)."
-                              );
+                              "(<img src=:/vrdp_disabled_16px.png/>).");
             if (vrdpsrv.GetEnabled())
                 tip += tr ("<hr>VRDP Server is listening on port %1").arg (vrdpsrv.GetPort());
-            vrdp_state->setToolTip (tip);
-#endif
-        }
-    }
-    if (element & SharedFolderStuff)
-    {
-        QString tip = tr ("<qt><nobr>Indicates the activity of shared folders:</nobr>"
-                          "%1</qt>",
-                          "Shared folders tooltip");
+            mVrdpLed->setToolTip (tip);
+#endif
+        }
+    }
+    if (aElement & SharedFolderStuff)
+    {
+        QString tip = tr ("<p style='white-space:pre'><nobr>Indicates the activity of "
+                          "shared folders:</nobr>%1</p>", "Shared folders tooltip");
 
         QString data;
@@ -2045,19 +2807,17 @@
         mDevicesSFMenu->setEnabled (true);
 
-        /// @todo later: add global folders
-
-        /* permanent folders */
-        CSharedFolderVector psfvec = cmachine.GetSharedFolders();
-
-        for (int i = 0; i < psfvec.size(); ++i)
-        {
-            CSharedFolder sf = psfvec[i];
+        /* Permanent folders */
+        CSharedFolderVector psfvec = machine.GetSharedFolders();
+
+        for (int i = 0; i < psfvec.size(); ++ i)
+        {
+            CSharedFolder sf = psfvec [i];
             sfs.insert (sf.GetName(), sf.GetHostPath());
         }
 
-        /* transient folders */
-        CSharedFolderVector tsfvec = cconsole.GetSharedFolders();
-
-        for (int i = 0; i < tsfvec.size(); ++i)
+        /* Transient folders */
+        CSharedFolderVector tsfvec = console.GetSharedFolders();
+
+        for (int i = 0; i < tsfvec.size(); ++ i)
         {
             CSharedFolder sf = tsfvec[i];
@@ -2065,32 +2825,28 @@
         }
 
-        for (QMap <QString, QString>::const_iterator it = sfs.constBegin();
-             it != sfs.constEnd(); ++ it)
+        for (QMap <QString, QString>::const_iterator it = sfs.constBegin(); it != sfs.constEnd(); ++ it)
         {
             /* Select slashes depending on the OS type */
-            if (VBoxGlobal::isDOSType (cconsole.GetGuest().GetOSTypeId()))
-                data += QString ("<br><nobr><b>\\\\vboxsvr\\%1&nbsp;</b></nobr>"
-                                 "<nobr>%2</nobr>")
-                    .arg (it.key(), it.value());
+            if (VBoxGlobal::isDOSType (console.GetGuest().GetOSTypeId()))
+                data += QString ("<br><nobr><b>\\\\vboxsvr\\%1&nbsp;</b></nobr><nobr>%2</nobr>")
+                                 .arg (it.key(), it.value());
             else
-                data += QString ("<br><nobr><b>%1&nbsp;</b></nobr>"
-                                 "<nobr>%2</nobr>")
-                    .arg (it.key(), it.value());
+                data += QString ("<br><nobr><b>%1&nbsp;</b></nobr><nobr>%2</nobr>")
+                                 .arg (it.key(), it.value());
         }
 
         if (sfs.count() == 0)
-            data = tr ("<br><nobr><b>No shared folders</b></nobr>",
-                       "Shared folders tooltip");
-
-        sf_light->setToolTip (tip.arg (data));
-    }
-    if (element & VirtualizationStuff)
-    {
-        bool virtEnabled = cconsole.GetDebugger().GetHWVirtExEnabled();
+            data = tr ("<br><nobr><b>No shared folders</b></nobr>", "Shared folders tooltip");
+
+        mSFLed->setToolTip (tip.arg (data));
+    }
+    if (aElement & VirtualizationStuff)
+    {
+        bool virtEnabled = console.GetDebugger().GetHWVirtExEnabled();
         QString virtualization = virtEnabled ?
             VBoxGlobal::tr ("Enabled", "details report (VT-x/AMD-V)") :
             VBoxGlobal::tr ("Disabled", "details report (VT-x/AMD-V)");
 
-        bool nestEnabled = cconsole.GetDebugger().GetHWVirtExNestedPagingEnabled();
+        bool nestEnabled = console.GetDebugger().GetHWVirtExNestedPagingEnabled();
         QString nestedPaging = nestEnabled ?
             VBoxVMInformationDlg::tr ("Enabled", "nested paging") :
@@ -2105,85 +2861,42 @@
                          .arg (VBoxVMInformationDlg::tr ("Nested Paging"), nestedPaging));
 
-        int cpuCount = cconsole.GetMachine().GetCPUCount();
+        int cpuCount = console.GetMachine().GetCPUCount();
         if (cpuCount > 1)
             tip += tr ("<br><nobr><b>%1:</b>&nbsp;%2</nobr>", "Virtualization Stuff LED")
-                      .arg (VBoxGlobal::tr ("Processor(s)", "details report")).arg (cpuCount);
+                       .arg (VBoxGlobal::tr ("Processor(s)", "details report")).arg (cpuCount);
 
         mVirtLed->setToolTip (tip);
         mVirtLed->setState (virtEnabled);
     }
-    if (element & PauseAction)
+    if (aElement & PauseAction)
     {
         if (!mVmPauseAction->isChecked())
         {
             mVmPauseAction->setText (VBoxGlobal::insertKeyToActionText (tr ("&Pause"), "P"));
-            mVmPauseAction->setStatusTip (
-                tr ("Suspend the execution of the virtual machine"));
+            mVmPauseAction->setStatusTip (tr ("Suspend the execution of the virtual machine"));
         }
         else
         {
             mVmPauseAction->setText (VBoxGlobal::insertKeyToActionText (tr ("R&esume"), "P"));
-            mVmPauseAction->setStatusTip (
-                tr ("Resume the execution of the virtual machine" ) );
+            mVmPauseAction->setStatusTip (tr ("Resume the execution of the virtual machine" ) );
         }
         mVmPauseAction->setEnabled (isRunningOrPaused);
     }
-    if (element & DisableMouseIntegrAction)
+    if (aElement & DisableMouseIntegrAction)
     {
         if (!mVmDisableMouseIntegrAction->isChecked())
         {
-            mVmDisableMouseIntegrAction->setText (VBoxGlobal::insertKeyToActionText (tr ("Disable &Mouse Integration"),
-                                                                                     "I"));
-            mVmDisableMouseIntegrAction->setStatusTip (
-                tr ("Temporarily disable host mouse pointer integration"));
+            mVmDisableMouseIntegrAction->setText (VBoxGlobal::insertKeyToActionText (tr ("Disable &Mouse Integration"), "I"));
+            mVmDisableMouseIntegrAction->setStatusTip (tr ("Temporarily disable host mouse pointer integration"));
         }
         else
         {
-            mVmDisableMouseIntegrAction->setText (VBoxGlobal::insertKeyToActionText (tr ("Enable &Mouse Integration"),
-                                                                                     "I"));
-            mVmDisableMouseIntegrAction->setStatusTip (
-                tr ("Enable temporarily disabled host mouse pointer integration"));
-        }
-        if (machine_state == KMachineState_Running)
-            mVmDisableMouseIntegrAction->setEnabled (console->isMouseAbsolute());
+            mVmDisableMouseIntegrAction->setText (VBoxGlobal::insertKeyToActionText (tr ("Enable &Mouse Integration"), "I"));
+            mVmDisableMouseIntegrAction->setStatusTip (tr ("Enable temporarily disabled host mouse pointer integration"));
+        }
+        if (mMachineState == KMachineState_Running)
+            mVmDisableMouseIntegrAction->setEnabled (mConsole->isMouseAbsolute());
         else
             mVmDisableMouseIntegrAction->setEnabled (false);
-    }
-}
-
-/**
- *  This function checks the status of required features and
- *  makes a warning and/or some action if something necessary
- *  is not in good condition.
- *  Does nothing if no console view was opened.
- */
-void VBoxConsoleWnd::checkRequiredFeatures()
-{
-    if (!console) return;
-
-    CConsole cconsole = console->console();
-
-    /* Check if the virtualization feature is required. */
-    bool is64BitsGuest    = vboxGlobal().virtualBox().GetGuestOSType (
-                            cconsole.GetGuest().GetOSTypeId()).GetIs64Bit();
-    bool fRecommendVirtEx = vboxGlobal().virtualBox().GetGuestOSType (
-                            cconsole.GetGuest().GetOSTypeId()).GetRecommendedVirtEx();
-    Assert(!is64BitsGuest || fRecommendVirtEx);
-    bool isVirtEnabled    = cconsole.GetDebugger().GetHWVirtExEnabled();
-    if (fRecommendVirtEx && !isVirtEnabled)
-    {
-        bool ret;
-
-        vmPause (true);
-
-        if (is64BitsGuest)
-            ret = vboxProblem().warnAboutVirtNotEnabled64BitsGuest();
-        else
-            ret = vboxProblem().warnAboutVirtNotEnabledGuestRequired();
-
-        if (ret == true)
-            close();
-        else
-            vmPause (false);
     }
 }
@@ -2200,18 +2913,18 @@
 
     QSize initialSize = size();
-    if (aSeamless || console->isAutoresizeGuestActive())
+    if (aSeamless || mConsole->isAutoresizeGuestActive())
     {
         QRect screen = aSeamless ?
             QApplication::desktop()->availableGeometry (this) :
             QApplication::desktop()->screenGeometry (this);
-        ULONG64 availBits = csession.GetMachine().GetVRAMSize() /* vram */
+        ULONG64 availBits = mSession.GetMachine().GetVRAMSize() /* vram */
                           * _1M /* mb to bytes */
                           * 8; /* to bits */
-        ULONG guestBpp = console->console().GetDisplay().GetBitsPerPixel();
+        ULONG guestBpp = mConsole->console().GetDisplay().GetBitsPerPixel();
         ULONG64 usedBits = (screen.width() /* display width */
                          * screen.height() /* display height */
                          * guestBpp
                          + _1M * 8) /* current cache per screen - may be changed in future */
-                         * csession.GetMachine().GetMonitorCount() /**< @todo fix assumption that all screens have same resolution */
+                         * mSession.GetMachine().GetMonitorCount() /**< @todo fix assumption that all screens have same resolution */
                          + 4096 * 8; /* adapter info */
         if (aOn && (availBits < usedBits))
@@ -2235,5 +2948,5 @@
     }
 
-    AssertReturn (console, false);
+    AssertReturn (mConsole, false);
     AssertReturn ((mHiddenChildren.empty() == aOn), false);
     AssertReturn ((aSeamless && mIsSeamless != aOn) ||
@@ -2286,5 +2999,5 @@
         mVmDisableMouseIntegrAction->setEnabled (!aOn);
 
-        console->console().GetDisplay().SetSeamlessMode (aOn);
+        mConsole->console().GetDisplay().SetSeamlessMode (aOn);
         mIsSeamless = aOn;
     }
@@ -2308,13 +3021,13 @@
     if (aOn)
     {
-        consoleSize = console->frameSize();
-        consoleSize -= QSize (console->frameWidth() * 2, console->frameWidth() * 2);
+        consoleSize = mConsole->frameSize();
+        consoleSize -= QSize (mConsole->frameWidth() * 2, mConsole->frameWidth() * 2);
 
         /* Toggle console to manual resize mode. */
-        console->setIgnoreMainwndResize (true);
+        mConsole->setIgnoreMainwndResize (true);
 
         /* Memorize the maximized state. */
         QDesktopWidget *dtw = QApplication::desktop();
-        was_max = isWindowMaximized() &&
+        mWasMax = isWindowMaximized() &&
                   dtw->availableGeometry().width()  == frameSize().width() &&
                   dtw->availableGeometry().height() == frameSize().height();
@@ -2324,6 +3037,6 @@
          * the exiting fullscreen. Required for correct scroll-view and
          * guest display update in SDL mode. */
-        prev_min_size = console->minimumSize();
-        console->setMinimumSize (0, 0);
+        mPrevMinSize = mConsole->minimumSize();
+        mConsole->setMinimumSize (0, 0);
 
         /* let the widget take the whole available desktop space */
@@ -2363,9 +3076,9 @@
         centralWidget()->setPalette (palette);
         centralWidget()->setAutoFillBackground (!aSeamless);
-        console_style = console->frameStyle();
-        console->setFrameStyle (QFrame::NoFrame);
-        console->setMaximumSize (scrGeo.size());
-        console->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
-        console->setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
+        mConsoleStyle = mConsole->frameStyle();
+        mConsole->setFrameStyle (QFrame::NoFrame);
+        mConsole->setMaximumSize (scrGeo.size());
+        mConsole->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
+        mConsole->setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
     }
     else
@@ -2380,5 +3093,5 @@
          * fullscreen. Required for correct scroll-view and guest display
          * update in SDL mode. */
-        console->setMinimumSize (prev_min_size);
+        mConsole->setMinimumSize (mPrevMinSize);
 
 #ifdef Q_WS_MAC
@@ -2399,8 +3112,8 @@
         centralWidget()->setPalette (mErasePalette);
         centralWidget()->setAutoFillBackground (false);
-        console->setFrameStyle (console_style);
-        console->setMaximumSize (console->sizeHint());
-        console->setHorizontalScrollBarPolicy (Qt::ScrollBarAsNeeded);
-        console->setVerticalScrollBarPolicy (Qt::ScrollBarAsNeeded);
+        mConsole->setFrameStyle (mConsoleStyle);
+        mConsole->setMaximumSize (mConsole->sizeHint());
+        mConsole->setHorizontalScrollBarPolicy (Qt::ScrollBarAsNeeded);
+        mConsole->setVerticalScrollBarPolicy (Qt::ScrollBarAsNeeded);
 
         /* Show everything hidden when going fullscreen. */
@@ -2443,5 +3156,5 @@
 
     /* Send guest size hint */
-    console->toggleFSMode (consoleSize);
+    mConsole->toggleFSMode (consoleSize);
 
     /* Process all console attributes changes and sub-widget hidings */
@@ -2465,20 +3178,4 @@
 }
 
-void VBoxConsoleWnd::changeDockIconUpdate (const VBoxChangeDockIconUpdateEvent &e)
-{
-#ifdef Q_WS_MAC
-    if (console)
-    {
-        console->setDockIconEnabled (e.mChanged);
-        console->updateDockOverlay();
-    }
-#else
-    Q_UNUSED (e);
-#endif
-}
-
-//
-// Private slots
-/////////////////////////////////////////////////////////////////////////////
 void VBoxConsoleWnd::switchToFullscreen (bool aOn, bool aSeamless)
 {
@@ -2556,1108 +3253,30 @@
 }
 
-void VBoxConsoleWnd::mtExitMode()
-{
-    if (mIsSeamless)
-        mVmSeamlessAction->toggle();
-    else
-        mVmFullscreenAction->toggle();
-}
-
-void VBoxConsoleWnd::mtCloseVM()
-{
-    mVmCloseAction->trigger();
-}
-
-void VBoxConsoleWnd::mtMaskUpdate()
-{
-    if (mIsSeamless)
-        setMask (console->lastVisibleRegion());
-}
-
-void VBoxConsoleWnd::vmFullscreen (bool aOn)
-{
-    bool ok = toggleFullscreenMode (aOn, false /* aSeamless */);
-    if (!ok)
-    {
-        /* on failure, restore the previous button state */
-        mVmFullscreenAction->blockSignals (true);
-        mVmFullscreenAction->setChecked (!aOn);
-        mVmFullscreenAction->blockSignals (false);
-    }
-}
-
-void VBoxConsoleWnd::vmSeamless (bool aOn)
-{
-    /* check if it is possible to enter/leave seamless mode */
-    if ((mIsSeamlessSupported && mIsGraphicsSupported) || !aOn)
-    {
-        bool ok = toggleFullscreenMode (aOn, true /* aSeamless */);
-        if (!ok)
-        {
-            /* on failure, restore the previous button state */
-            mVmSeamlessAction->blockSignals (true);
-            mVmSeamlessAction->setChecked (!aOn);
-            mVmSeamlessAction->blockSignals (false);
-        }
-    }
-}
-
-void VBoxConsoleWnd::vmAutoresizeGuest (bool on)
-{
-    if (!console)
+/**
+ *  Closes the console view opened by openView().
+ *  Does nothing if no console view was opened.
+ */
+void VBoxConsoleWnd::closeView()
+{
+    LogFlowFuncEnter();
+
+    if (!mConsole)
+    {
+        LogFlow (("Already closed!\n"));
+        LogFlowFuncLeave();
         return;
-
-    /* Currently, we use only "off" and "on" icons. Later,
-     * we may want to use disabled versions of icons when no guest additions
-     * are available (to indicate that this function is ineffective). */
-#if 0
-    autoresize_state->setState (on ? 3 : 1);
-#endif
-
-    console->setAutoresizeGuest (on);
-}
-
-void VBoxConsoleWnd::vmAdjustWindow()
-{
-    if (console)
-    {
-        if (isWindowMaximized())
-            showNormal();
-        console->normalizeGeometry (true /* adjustPosition */);
-    }
-}
-
-void VBoxConsoleWnd::vmTypeCAD()
-{
-    if (console)
-    {
-        CKeyboard keyboard  = console->console().GetKeyboard();
-        Assert (!keyboard.isNull());
-        keyboard.PutCAD();
-        AssertWrapperOk (keyboard);
-    }
-}
-
-void VBoxConsoleWnd::vmTypeCABS()
-{
-#if defined(Q_WS_X11)
-    if (console)
-    {
-        CKeyboard keyboard  = console->console().GetKeyboard();
-        Assert (!keyboard.isNull());
-        static QVector <LONG> sSequence (6);
-        sSequence[0] = 0x1d; // Ctrl down
-        sSequence[1] = 0x38; // Alt down
-        sSequence[2] = 0x0E; // Backspace down
-        sSequence[3] = 0x8E; // Backspace up
-        sSequence[4] = 0xb8; // Alt up
-        sSequence[5] = 0x9d; // Ctrl up
-        keyboard.PutScancodes (sSequence);
-        AssertWrapperOk (keyboard);
-    }
-#else
-    /* we have to define this slot anyway because MOC doesn't understand ifdefs */
-#endif
-}
-
-void VBoxConsoleWnd::vmReset()
-{
-    if (console)
-    {
-        if (vboxProblem().confirmVMReset (this))
-            console->console().Reset();
-    }
-}
-
-void VBoxConsoleWnd::vmPause (bool on)
-{
-    if (console)
-    {
-        console->pause (on);
-        updateAppearanceOf (PauseAction);
-    }
-}
-
-void VBoxConsoleWnd::vmACPIShutdown()
-{
-    if (!csession.GetConsole().GetGuestEnteredACPIMode())
-        return vboxProblem().cannotSendACPIToMachine();
-
-    if (console)
-    {
-        CConsole cconsole = console->console();
-        cconsole.PowerButton();
-        if (!cconsole.isOk())
-            vboxProblem().cannotACPIShutdownMachine (cconsole);
-    }
-}
-
-void VBoxConsoleWnd::vmClose()
-{
-    if (console)
-    {
-        close();
-    }
-}
-
-void VBoxConsoleWnd::vmTakeSnapshot()
-{
-    AssertReturn (console, (void) 0);
-
-    /* remember the paused state */
-    bool wasPaused = machine_state == KMachineState_Paused;
-    if (!wasPaused)
-    {
-        /* Suspend the VM and ignore the close event if failed to do so.
-         * pause() will show the error message to the user. */
-        if (!console->pause (true))
-            return;
-    }
-
-    CMachine cmachine = csession.GetMachine();
-
-    VBoxTakeSnapshotDlg dlg (this);
-
-    QString typeId = cmachine.GetOSTypeId();
-    dlg.mLbIcon->setPixmap (vboxGlobal().vmGuestOSTypeIcon (typeId));
-
-    /* search for the max available filter index */
-    int maxSnapShotIndex = 0;
-    QString snapShotName = tr ("Snapshot %1");
-    QRegExp regExp (QString ("^") + snapShotName.arg ("([0-9]+)") + QString ("$"));
-    CSnapshot index = cmachine.GetSnapshot (QString::null);
-    while (!index.isNull())
-    {
-        /* Check the current snapshot name */
-        QString name = index.GetName();
-        int pos = regExp.indexIn (name);
-        if (pos != -1)
-            maxSnapShotIndex = regExp.cap (1).toInt() > maxSnapShotIndex ?
-                               regExp.cap (1).toInt() : maxSnapShotIndex;
-        /* Traversing to the next child */
-        CSnapshotVector c = index.GetChildren();
-        if (c.size() > 0)
-            index = c[0];
-        else
-            break;
-    }
-    dlg.mLeName->setText (snapShotName.arg (maxSnapShotIndex + 1));
-
-    if (dlg.exec() == QDialog::Accepted)
-    {
-        CConsole cconsole = csession.GetConsole();
-
-        CProgress progress =
-            cconsole.TakeSnapshot (dlg.mLeName->text().trimmed(),
-                                   dlg.mTeDescription->toPlainText());
-
-        if (cconsole.isOk())
-        {
-            /* show the "Taking Snapshot" progress dialog */
-            vboxProblem().
-                showModalProgressDialog (progress, cmachine.GetName(), this, 0);
-
-            if (progress.GetResultCode() != 0)
-                vboxProblem().cannotTakeSnapshot (progress);
-        }
-        else
-            vboxProblem().cannotTakeSnapshot (cconsole);
-    }
-
-    /* restore the running state if needed */
-    if (!wasPaused)
-        console->pause (false);
-}
-
-void VBoxConsoleWnd::vmShowInfoDialog()
-{
-    VBoxVMInformationDlg::createInformationDlg (csession, console);
-}
-
-void VBoxConsoleWnd::vmDisableMouseIntegr (bool aOff)
-{
-    if (console)
-    {
-        console->setMouseIntegrationEnabled (!aOff);
-        updateAppearanceOf (DisableMouseIntegrAction);
-    }
-}
-
-void VBoxConsoleWnd::devicesMountFloppyImage()
-{
-    if (!console) return;
-
-    VBoxMediaManagerDlg dlg (this);
-
-    dlg.setup (VBoxDefs::MediumType_Floppy, true /* aDoSelect */,
-               true /* aRefresh */, csession.GetMachine());
-
-    if (dlg.exec() == QDialog::Accepted)
-    {
-        CMachine m = csession.GetMachine();
-
-        m.MountMedium ("Floppy Controller", 0, 0, dlg.selectedId());
-
-        AssertWrapperOk (m);
-        if (m.isOk())
-        {
-            if (mIsAutoSaveMedia)
-            {
-                m.SaveSettings();
-                if (!m.isOk())
-                    vboxProblem().cannotSaveMachineSettings (m);
-            }
-        }
-    }
-}
-
-void VBoxConsoleWnd::devicesUnmountFloppy()
-{
-    if (!console) return;
-
-    CMachine m = csession.GetMachine();
-    m.MountMedium ("Floppy Controller", 0, 0, NULL);
-    if (m.isOk())
-    {
-        if (mIsAutoSaveMedia)
-        {
-            m.SaveSettings();
-            if (!m.isOk())
-                vboxProblem().cannotSaveMachineSettings (m);
-        }
-    }
-
-    if (!m.GetMedium ("Floppy Controller", 0, 0).isNull())
-    {
-        /* Looks like Main make no force unmounting here
-         * but IFloppyDrive::Unmount() is called synchronously.
-         * Also Main performs rollback for this procedure if
-         * it was failed by some reason - for example if the
-         * guest OS locked IFloppyDrive preventing image from
-         * unmounting - so no way to know the error was really
-         * occured. Thats why we just checking the drive state
-         * and warn a user about problem if present. */
-        vboxProblem().cannotEjectDrive();
-    }
-}
-
-void VBoxConsoleWnd::devicesMountDVDImage()
-{
-    if (!console) return;
-
-    VBoxMediaManagerDlg dlg (this);
-
-    dlg.setup (VBoxDefs::MediumType_DVD, true /* aDoSelect */,
-               true /* aRefresh */, csession.GetMachine());
-
-    if (dlg.exec() == QDialog::Accepted)
-    {
-        CMachine m = csession.GetMachine();
-
-        m.MountMedium ("IDE Controller", 1, 0, dlg.selectedId());
-
-        AssertWrapperOk (m);
-        if (m.isOk())
-        {
-            if (mIsAutoSaveMedia)
-            {
-                m.SaveSettings();
-                if (!m.isOk())
-                    vboxProblem().cannotSaveMachineSettings (m);
-            }
-        }
-    }
-}
-
-
-void VBoxConsoleWnd::devicesUnmountDVD()
-{
-    if (!console) return;
-
-    CMachine m = csession.GetMachine();
-    m.MountMedium ("IDE Controller", 1, 0, NULL);
-    AssertWrapperOk (m);
-    if (m.isOk())
-    {
-        if (mIsAutoSaveMedia)
-        {
-            m.SaveSettings();
-            if (!m.isOk())
-                vboxProblem().cannotSaveMachineSettings (m);
-        }
-    }
-
-    if (!m.GetMedium("IDE Controller", 1, 0).isNull())
-    {
-        /* Looks like Main make no force unmounting here
-         * but IDVDDrive::Unmount() is called synchronously.
-         * Also Main performs rollback for this procedure if
-         * it was failed by some reason - for example if the
-         * guest OS locked IDVDDrive preventing image from
-         * unmounting - so no way to know the error was really
-         * occured. Thats why we just checking the drive state
-         * and warn a user about problem if present. */
-        vboxProblem().cannotEjectDrive();
-    }
-}
-
-void VBoxConsoleWnd::devicesSwitchVrdp (bool aOn)
-{
-    if (!console) return;
-
-    CVRDPServer vrdpServer = csession.GetMachine().GetVRDPServer();
-    /* this method should not be executed if vrdpServer is null */
-    Assert (!vrdpServer.isNull());
-
-    vrdpServer.SetEnabled (aOn);
-    updateAppearanceOf (VRDPStuff);
-}
-
-void VBoxConsoleWnd::devicesOpenNetworkDialog()
-{
-    if (!console) return;
-
-    VBoxNetworkDialog dlg (console, csession);
-    dlg.exec();
-}
-
-void VBoxConsoleWnd::devicesOpenSFDialog()
-{
-    if (!console) return;
-
-    VBoxSFDialog dlg (console, csession);
-    dlg.exec();
-}
-
-void VBoxConsoleWnd::devicesInstallGuestAdditions()
-{
-#if defined (DEBUG_dmik) /* subscribe yourself here if you care for this behavior. */
-    QString src1 = qApp->applicationDirPath() + "/../../release/bin/VBoxGuestAdditions.iso";
-    QString src2 = qApp->applicationDirPath() + "/../../release/bin/additions/VBoxGuestAdditions.iso";
-#else
-    char szAppPrivPath [RTPATH_MAX];
-    int rc = RTPathAppPrivateNoArch (szAppPrivPath, sizeof (szAppPrivPath));
-    AssertRC (rc);
-
-    QString src1 = QString (szAppPrivPath) + "/VBoxGuestAdditions.iso";
-    QString src2 = qApp->applicationDirPath() + "/additions/VBoxGuestAdditions.iso";
-#endif
-
-    /* Check the standard image locations */
-    if (QFile::exists (src1))
-        return installGuestAdditionsFrom (src1);
-    else if (QFile::exists (src2))
-        return installGuestAdditionsFrom (src2);
-
-    /* Check for the already registered image */
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    QString name = QString ("VBoxGuestAdditions_%1.iso")
-                            .arg (vbox.GetVersion().remove ("_OSE"));
-
-    CMediumVector vec = vbox.GetDVDImages();
-    for (CMediumVector::ConstIterator it = vec.begin();
-         it != vec.end(); ++ it)
-    {
-        QString path = it->GetLocation();
-        /* Compare the name part ignoring the file case */
-        QString fn = QFileInfo (path).fileName();
-        if (RTPathCompare (name.toUtf8().constData(), fn.toUtf8().constData()) == 0)
-            return installGuestAdditionsFrom (path);
-    }
-
-    /* Download the required image */
-    int result = vboxProblem().cannotFindGuestAdditions (
-        QDir::toNativeSeparators (src1), QDir::toNativeSeparators (src2));
-    if (result == QIMessageBox::Yes)
-    {
-        QString source = QString ("http://download.virtualbox.org/virtualbox/%1/")
-                                  .arg (vbox.GetVersion().remove ("_OSE")) + name;
-        QString target = QDir (vboxGlobal().virtualBox().GetHomeFolder())
-                               .absoluteFilePath (name);
-
-        VBoxAdditionsDownloader *dl =
-            new VBoxAdditionsDownloader (source, target, mDevicesInstallGuestToolsAction);
-        statusBar()->addWidget (dl, 0);
-        dl->start();
-    }
-}
-
-void VBoxConsoleWnd::installGuestAdditionsFrom (const QString &aSource)
-{
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    QString uuid;
-
-    CMedium image = vbox.FindDVDImage (aSource);
-    if (image.isNull())
-    {
-        image = vbox.OpenDVDImage (aSource, uuid);
-        if (vbox.isOk())
-            uuid = image.GetId();
-    }
-    else
-        uuid = image.GetId();
-
-    if (!vbox.isOk())
-        return vboxProblem().cannotOpenMedium (this, vbox,
-                                               VBoxDefs::MediumType_DVD, aSource);
-
-    Assert (!uuid.isNull());
-    CMachine m = csession.GetMachine();
-    m.MountMedium ("IDE Controller", 1, 0, uuid);
-    AssertWrapperOk (m);
-    if (m.isOk())
-    {
-        if (mIsAutoSaveMedia)
-        {
-            m.SaveSettings();
-            if (!m.isOk())
-                vboxProblem().cannotSaveMachineSettings (m);
-        }
-    }
-}
-
-void VBoxConsoleWnd::setMask (const QRegion &aRegion)
-{
-    QRegion region = aRegion;
-
-    /* The global mask shift cause of toolbars and such things. */
-    region.translate (mMaskShift.width(), mMaskShift.height());
-
-    /* Including mini toolbar area */
-    QRegion toolBarRegion (mMiniToolBar->mask());
-    toolBarRegion.translate (mMiniToolBar->mapToGlobal (toolBarRegion.boundingRect().topLeft()) - QPoint (1, 0));
-    region += toolBarRegion;
-
-    /* Restrict the drawing to the available space on the screen.
-     * (The &operator is better than the previous used -operator,
-     * because this excludes space around the real screen also.
-     * This is necessary for the mac.) */
-    region &= mStrictedRegion;
-
-#ifdef Q_WS_WIN
-    QRegion difference = mPrevRegion.subtract (region);
-
-    /* Region offset calculation */
-    int fleft = 0, ftop = 0;
-    /* I think this isn't necessary anymore because the 4 shifting spacer.
-     * Has to be verified. */
-//    if (isTopLevel())
-//    {
-//        ftop = topData()->ftop;
-//        fleft = topData()->fleft;
-//    }
-
-    /* Visible region calculation */
-    HRGN newReg = CreateRectRgn (0, 0, 0, 0);
-    CombineRgn (newReg, region.handle(), 0, RGN_COPY);
-    OffsetRgn (newReg, fleft, ftop);
-
-    /* Invisible region calculation */
-    HRGN diffReg = CreateRectRgn (0, 0, 0, 0);
-    CombineRgn (diffReg, difference.handle(), 0, RGN_COPY);
-    OffsetRgn (diffReg, fleft, ftop);
-
-    /* Set the current visible region and clean the previous */
-    SetWindowRgn (winId(), newReg, FALSE);
-    RedrawWindow (NULL, NULL, diffReg, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
-    RedrawWindow (console->viewport()->winId(), NULL, NULL, RDW_INVALIDATE);
-
-    mPrevRegion = region;
-#elif defined(Q_WS_MAC)
-# if defined(VBOX_GUI_USE_QUARTZ2D)
-    if (vboxGlobal().vmRenderMode() == VBoxDefs::Quartz2DMode)
-    {
-        /* If we are using the Quartz2D backend we have to trigger
-         * an repaint only. All the magic clipping stuff is done
-         * in the paint engine. */
-        ::darwinWindowInvalidateShape (console->viewport());
-    }
-    else
-# endif
-    {
-        /* This is necessary to avoid the flicker by an mask update.
-         * See http://lists.apple.com/archives/Carbon-development/2001/Apr/msg01651.html
-         * for the hint.
-         * There *must* be a better solution. */
-        if (!region.isEmpty())
-            region |= QRect (0, 0, 1, 1);
-//        /* Save the current region for later processing in the darwin event handler. */
-//        mCurrRegion = region;
-//        /* We repaint the screen before the ReshapeCustomWindow command. Unfortunately
-//         * this command flushes a copy of the backbuffer to the screen after the new
-//         * mask is set. This leads into a missplaced drawing of the content. Currently
-//         * no alternative to this and also this is not 100% perfect. */
-//        repaint();
-//        qApp->processEvents();
-//        /* Now force the reshaping of the window. This is definitly necessary. */
-//        ReshapeCustomWindow (reinterpret_cast <WindowPtr> (winId()));
-        QMainWindow::setMask (region);
-//        HIWindowInvalidateShadow (::darwinToWindowRef (console->viewport()));
-    }
-#else
-    QMainWindow::setMask (region);
-#endif
-}
-
-void VBoxConsoleWnd::clearMask()
-{
-#ifdef Q_WS_WIN
-    SetWindowRgn (winId(), 0, TRUE);
-#else
-    QMainWindow::clearMask();
-#endif
-}
-
-/**
- *  Prepares the "Mount Floppy..." menu by populating the existent host
- *  floppies.
- */
-void VBoxConsoleWnd::prepareFloppyMenu()
-{
-    if (!console) return;
-
-    mDevicesMountFloppyMenu->clear();
-
-    CMedium selected = csession.GetMachine().GetMedium("Floppy Controller", 0, 0);
-
-    hostFloppyMap.clear();
-    CMediumVector drvvec =
-        vboxGlobal().virtualBox().GetHost().GetFloppyDrives();
-    for (int i = 0; i < drvvec.size(); ++i)
-    {
-        CMedium hostFloppy = drvvec[i];
-        /** @todo set icon */
-        QString drvName = hostFloppy.GetName();
-        QString description = hostFloppy.GetDescription();
-        QString fullName = description.isEmpty() ?
-            drvName :
-            QString ("%1 (%2)").arg (description, drvName);
-        QAction *action = mDevicesMountFloppyMenu->addAction (tr ("Host Drive ") + fullName);
-        action->setStatusTip (tr ("Mount the selected physical drive of the host PC",
-                                  "Floppy tip"));
-        hostFloppyMap [action] = hostFloppy;
-        if (machine_state != KMachineState_Running && machine_state != KMachineState_Paused)
-            action->setEnabled (false);
-        else if (!selected.isNull())
-            if (!selected.GetName().compare (hostFloppy.GetName()))
-                action->setEnabled (false);
-    }
-
-    if (mDevicesMountFloppyMenu->actions().count() > 0)
-        mDevicesMountFloppyMenu->addSeparator();
-    mDevicesMountFloppyMenu->addAction (mDevicesMountFloppyImageAction);
-
-    /* if shown as a context menu */
-    if(mDevicesMountFloppyMenu->menuAction()->data().toBool())
-    {
-        mDevicesMountFloppyMenu->addSeparator();
-        mDevicesMountFloppyMenu->addAction (mDevicesUnmountFloppyAction);
-    }
-}
-
-/**
- *  Prepares the "Capture DVD..." menu by populating the existent host
- *  CD/DVD-ROM drives.
- */
-void VBoxConsoleWnd::prepareDVDMenu()
-{
-    if (!console) return;
-
-    mDevicesMountDVDMenu->clear();
-
-    CMedium selected = csession.GetMachine().GetMedium("IDE Controller", 1, 0);
-
-    hostDVDMap.clear();
-    CMediumVector drvvec =
-        vboxGlobal().virtualBox().GetHost().GetDVDDrives();
-    for (int i = 0; i < drvvec.size(); ++i)
-    {
-        CMedium hostDVD = drvvec[i];
-        /** @todo set icon */
-        QString drvName = hostDVD.GetName();
-        QString description = hostDVD.GetDescription();
-        QString fullName = description.isEmpty() ?
-            drvName :
-            QString ("%1 (%2)").arg (description, drvName);
-        QAction *action = mDevicesMountDVDMenu->addAction (
-            tr ("Host Drive ") + fullName);
-        action->setStatusTip (tr ("Mount the selected physical drive of the host PC",
-                                  "CD/DVD tip"));
-        hostDVDMap [action] = hostDVD;
-        if (machine_state != KMachineState_Running && machine_state != KMachineState_Paused)
-            action->setEnabled (false);
-        else if (!selected.isNull())
-            if (!selected.GetName().compare (hostDVD.GetName()))
-                action->setEnabled (false);
-    }
-
-    if (mDevicesMountDVDMenu->actions().count() > 0)
-        mDevicesMountDVDMenu->addSeparator();
-    mDevicesMountDVDMenu->addAction (mDevicesMountDVDImageAction);
-
-    /* if shown as a context menu */
-    if(mDevicesMountDVDMenu->menuAction()->data().toBool())
-    {
-        mDevicesMountDVDMenu->addSeparator();
-        mDevicesMountDVDMenu->addAction (mDevicesUnmountDVDAction);
-    }
-}
-
-void VBoxConsoleWnd::prepareNetworkMenu()
-{
-    mDevicesNetworkMenu->clear();
-    mDevicesNetworkMenu->addAction (mDevicesNetworkDialogAction);
-}
-
-void VBoxConsoleWnd::prepareSFMenu()
-{
-    mDevicesSFMenu->clear();
-    mDevicesSFMenu->addAction (mDevicesSFDialogAction);
-}
-
-void VBoxConsoleWnd::statusTipChanged (const QString & /*aMes*/)
-{
-    mStatusBarChangedInside = mWaitForStatusBarChange;
-    mWaitForStatusBarChange = false;
-}
-
-void VBoxConsoleWnd::clearStatusBar()
-{
-    if (mStatusBarChangedInside)
-        statusBar()->clearMessage();
-}
-
-/**
- *  Captures a floppy device corresponding to a given menu action.
- */
-void VBoxConsoleWnd::captureFloppy (QAction *aAction)
-{
-    if (!console) return;
-
-    CMedium d = hostFloppyMap [aAction];
-    /* if null then some other item but host drive is selected */
-    if (d.isNull()) return;
-
-    CMachine m = csession.GetMachine();
-    m.MountMedium ("Floppy Controller", 0, 0, d.GetId());
-    AssertWrapperOk (m);
-
-    if (m.isOk())
-    {
-        if (mIsAutoSaveMedia)
-        {
-            m.SaveSettings();
-            if (!m.isOk())
-                vboxProblem().cannotSaveMachineSettings (m);
-        }
-    }
-}
-
-/**
- *  Captures a CD/DVD-ROM device corresponding to a given menu action.
- */
-void VBoxConsoleWnd::captureDVD (QAction *aAction)
-{
-    if (!console) return;
-
-    CMedium d = hostDVDMap [aAction];
-    /* if null then some other item but host drive is selected */
-    if (d.isNull()) return;
-
-    CMachine m = csession.GetMachine();
-    m.MountMedium ("IDE Controller", 1, 0, d.GetId());
-    AssertWrapperOk (m);
-
-    if (m.isOk())
-    {
-        if (mIsAutoSaveMedia)
-        {
-            m.SaveSettings();
-            if (!m.isOk())
-                vboxProblem().cannotSaveMachineSettings (m);
-        }
-    }
-}
-
-/**
- *  Attach/Detach selected USB Device.
- */
-void VBoxConsoleWnd::switchUSB (QAction *aAction)
-{
-    if (!console) return;
-
-    CConsole cconsole = csession.GetConsole();
-    AssertWrapperOk (csession);
-
-    CUSBDevice usb = mDevicesUSBMenu->getUSB (aAction);
-    /* if null then some other item but a USB device is selected */
-    if (usb.isNull())
-        return;
-
-    if (!aAction->isChecked())
-    {
-        cconsole.DetachUSBDevice (usb.GetId());
-        if (!cconsole.isOk())
-        {
-            /// @todo (r=dmik) the dialog should be either modeless
-            //  or we have to pause the VM
-            vboxProblem().cannotDetachUSBDevice (cconsole,
-                                                 vboxGlobal().details (usb));
-        }
-    }
-    else
-    {
-        cconsole.AttachUSBDevice (usb.GetId());
-        if (!cconsole.isOk())
-        {
-            /// @todo (r=dmik) the dialog should be either modeless
-            //  or we have to pause the VM
-            vboxProblem().cannotAttachUSBDevice (cconsole,
-                                                 vboxGlobal().details (usb));
-        }
-    }
-}
-
-void VBoxConsoleWnd::showIndicatorContextMenu (QIStateIndicator *ind, QContextMenuEvent *e)
-{
-    if (ind == cd_light)
-    {
-        /* set "this is a context menu" flag */
-        mDevicesMountDVDMenu->menuAction()->setData (true);
-        mDevicesMountDVDMenu->exec (e->globalPos());
-        mDevicesMountDVDMenu->menuAction()->setData (false);
-    }
-    else
-    if (ind == fd_light)
-    {
-        /* set "this is a context menu" flag */
-        mDevicesMountFloppyMenu->menuAction()->setData (true);
-        mDevicesMountFloppyMenu->exec (e->globalPos());
-        mDevicesMountFloppyMenu->menuAction()->setData (false);
-    }
-    else
-    if (ind == usb_light)
-    {
-        if (mDevicesUSBMenu->isEnabled())
-        {
-            /* set "this is a context menu" flag */
-            mDevicesUSBMenu->menuAction()->setData (true);
-            mDevicesUSBMenu->exec (e->globalPos());
-            mDevicesUSBMenu->menuAction()->setData (false);
-        }
-    }
-    else
-    /* if (ind == vrdp_state)
-    {
-        mDevicesVRDPMenu->exec (e->globalPos());
-    }
-    else */
-    if (ind == autoresize_state)
-    {
-        mVmAutoresizeMenu->exec (e->globalPos());
-    }
-    else
-    if (ind == mouse_state)
-    {
-        mVmDisMouseIntegrMenu->exec (e->globalPos());
-    }
-    else
-    if (ind == sf_light)
-    {
-        if (mDevicesSFMenu->isEnabled())
-        {
-            mDevicesSFMenu->menuAction()->setData (true);
-            mDevicesSFMenu->exec (e->globalPos());
-            mDevicesSFMenu->menuAction()->setData (false);
-        }
-    }
-    else
-    if (ind == net_light)
-    {
-        if (mDevicesNetworkMenu->isEnabled())
-        {
-            mDevicesNetworkMenu->menuAction()->setData (true);
-            mDevicesNetworkMenu->exec (e->globalPos());
-            mDevicesNetworkMenu->menuAction()->setData (false);
-        }
-    }
-}
-
-void VBoxConsoleWnd::updateDeviceLights()
-{
-    if (console) {
-        CConsole &cconsole = console->console();
-        int st;
-        if (hd_light->state() != KDeviceActivity_Null) {
-            st = cconsole.GetDeviceActivity (KDeviceType_HardDisk);
-            if (hd_light->state() != st)
-                hd_light->setState (st);
-        }
-        if (cd_light->state() != KDeviceActivity_Null) {
-            st = cconsole.GetDeviceActivity (KDeviceType_DVD);
-            if (cd_light->state() != st)
-                cd_light->setState (st);
-        }
-        if (fd_light->state() != KDeviceActivity_Null) {
-            st = cconsole.GetDeviceActivity (KDeviceType_Floppy);
-            if (fd_light->state() != st)
-                fd_light->setState (st);
-        }
-        if (net_light->state() != KDeviceActivity_Null) {
-            st = cconsole.GetDeviceActivity (KDeviceType_Network);
-            if (net_light->state() != st)
-                net_light->setState (st);
-        }
-        if (usb_light->state() != KDeviceActivity_Null) {
-            st = cconsole.GetDeviceActivity (KDeviceType_USB);
-            if (usb_light->state() != st)
-                usb_light->setState (st);
-        }
-        if (sf_light->state() != KDeviceActivity_Null) {
-            st = cconsole.GetDeviceActivity (KDeviceType_SharedFolder);
-            if (sf_light->state() != st)
-                sf_light->setState (st);
-        }
-    }
-}
-
-void VBoxConsoleWnd::updateMachineState (KMachineState state)
-{
-    bool guruMeditation = false;
-
-    if (console && machine_state != state)
-    {
-        if (state >= KMachineState_Running)
-        {
-            switch (state)
-            {
-                case KMachineState_Stuck:
-                {
-                    guruMeditation = true;
-                    break;
-                }
-                case KMachineState_Paused:
-                {
-                    if (!mVmPauseAction->isChecked())
-                        mVmPauseAction->setChecked (true);
-                    break;
-                }
-                case KMachineState_Running:
-                {
-                    if (machine_state == KMachineState_Paused && mVmPauseAction->isChecked())
-                        mVmPauseAction->setChecked (false);
-                    break;
-                }
-#ifdef Q_WS_X11
-                case KMachineState_Starting:
-                {
-                    /* The keyboard handler may wish to do some release logging
-                       on startup.  Tell it that the logger is now active. */
-                    doXKeyboardLogging(QX11Info::display());
-                    break;
-                }
-#endif
-                default:
-                    break;
-            }
-        }
-
-        bool isRunningOrPaused = state == KMachineState_Running ||
-                                 state == KMachineState_Paused;
-
-        /* enable/disable actions that are not managed by
-         * updateAppearanceOf() */
-
-        mRunningActions->setEnabled (state == KMachineState_Running);
-        mRunningOrPausedActions->setEnabled (isRunningOrPaused);
-
-        machine_state = state;
-
-        updateAppearanceOf (Caption | FloppyStuff | DVDStuff | NetworkStuff |
-                            USBStuff | VRDPStuff | PauseAction |
-                            DisableMouseIntegrAction);
-
-        if (state < KMachineState_Running)
-        {
-            /*
-             *  VM has been powered off or saved or aborted, no matter
-             *  internally or externally -- we must *safely* close the console
-             *  window unless auto closure is disabled.
-             */
-            if (!no_auto_close)
-                tryClose();
-        }
-    }
-
-    if (guruMeditation)
-    {
-        CConsole cconsole = console->console();
-        QString logFolder = cconsole.GetMachine().GetLogFolder();
-
-        /* Take the screenshot for debugging purposes and save it */
-        QString fname = logFolder + "/VBox.png";
-
-        /// @todo for some reason, IDisplay::takeScreenShot() may not work
-        /// properly on a VM which is Stuck -- investigate it.
-        CDisplay dsp = cconsole.GetDisplay();
-        QImage shot = QImage (dsp.GetWidth(), dsp.GetHeight(), QImage::Format_RGB32);
-        dsp.TakeScreenShot (shot.bits(), shot.width(), shot.height());
-        shot.save (QFile::encodeName (fname), "PNG");
-
-        if (vboxProblem().remindAboutGuruMeditation (
-                cconsole, QDir::toNativeSeparators (logFolder)))
-        {
-            qApp->processEvents();
-            cconsole.PowerDown();
-            if (!cconsole.isOk())
-                vboxProblem().cannotStopMachine (cconsole);
-        }
-    }
-
-#ifdef Q_WS_MAC
-    if (console)
-        console->updateDockOverlay();
-#endif
-}
-
-void VBoxConsoleWnd::updateMouseState (int state)
-{
-    mVmDisableMouseIntegrAction->setEnabled (state & VBoxConsoleView::MouseAbsolute);
-
-    if ((state & VBoxConsoleView::MouseAbsoluteDisabled) &&
-        (state & VBoxConsoleView::MouseAbsolute) &&
-        !(state & VBoxConsoleView::MouseCaptured))
-    {
-        mouse_state->setState (4);
-    }
-    else
-    {
-        mouse_state->setState (state & (VBoxConsoleView::MouseAbsolute |
-                                        VBoxConsoleView::MouseCaptured));
-    }
-}
-
-
-void VBoxConsoleWnd::updateAdditionsState (const QString &aVersion,
-                                           bool aActive,
-                                           bool aSeamlessSupported,
-                                           bool aGraphicsSupported)
-{
-    mVmAutoresizeGuestAction->setEnabled (aActive && aGraphicsSupported);
-    if (   (mIsSeamlessSupported != aSeamlessSupported)
-        || (mIsGraphicsSupported != aGraphicsSupported))
-    {
-        mVmSeamlessAction->setEnabled (aSeamlessSupported && aGraphicsSupported);
-        mIsSeamlessSupported = aSeamlessSupported;
-        mIsGraphicsSupported = aGraphicsSupported;
-        /* If seamless mode should be enabled then check if it is enabled
-         * currently and re-enable it if open-view procedure is finished */
-        if (   mVmSeamlessAction->isChecked()
-            && mIsOpenViewFinished
-            && aSeamlessSupported
-            && aGraphicsSupported)
-            toggleFullscreenMode (true, true);
-        /* Disable auto-resizing if advanced graphics are not available */
-        console->setAutoresizeGuest (   mIsGraphicsSupported
-                                     && mVmAutoresizeGuestAction->isChecked());
-        mVmAutoresizeGuestAction->setEnabled (mIsGraphicsSupported);
-    }
-
-    /* Check the GA version only in case of additions are active */
-    if (!aActive)
-        return;
-
-    /* Check the Guest Additions version and warn the user about possible
-     * compatibility issues in case if the installed version is outdated. */
-    uint version = aVersion.toUInt();
-    QString versionStr = QString ("%1.%2")
-        .arg (RT_HIWORD (version)).arg (RT_LOWORD (version));
-    QString expectedStr = QString ("%1.%2")
-        .arg (VMMDEV_VERSION_MAJOR).arg (VMMDEV_VERSION_MINOR); /** @todo r=bird: This isn't want we want! We want the VirtualBox version of the additions, all three numbers. See @bugref{4084}.*/
-
-    if (RT_HIWORD (version) < VMMDEV_VERSION_MAJOR)
-    {
-        vboxProblem().warnAboutTooOldAdditions (this, versionStr, expectedStr);
-    }
-    else if (RT_HIWORD (version) == VMMDEV_VERSION_MAJOR &&
-             RT_LOWORD (version) <  VMMDEV_VERSION_MINOR)
-    {
-        vboxProblem().warnAboutOldAdditions (this, versionStr, expectedStr);
-    }
-    else if (version > VMMDEV_VERSION)
-    {
-        vboxProblem().warnAboutNewAdditions (this, versionStr, expectedStr);
-    }
-}
-
-void VBoxConsoleWnd::updateMediaDriveState (VBoxDefs::MediumType aType)
-{
-    Assert (aType == VBoxDefs::MediumType_DVD || aType == VBoxDefs::MediumType_Floppy);
-    updateAppearanceOf (aType == VBoxDefs::MediumType_DVD ? DVDStuff :
-                        aType == VBoxDefs::MediumType_Floppy ? FloppyStuff :
-                        AllStuff);
-}
-
-void VBoxConsoleWnd::updateSharedFoldersState()
-{
-    updateAppearanceOf (SharedFolderStuff);
-}
-
-void VBoxConsoleWnd::updateUsbState()
-{
-    updateAppearanceOf (USBStuff);
-}
-
-void VBoxConsoleWnd::updateNetworkAdaptersState()
-{
-    updateAppearanceOf (NetworkStuff);
-}
-
-/**
- *  Helper to safely close the main console window.
- *
- *  This method ensures that close() will not be called if there is some
- *  modal widget currently being executed, as it can cause uninitialization
- *  at the point of code where it is not expected at all (example:
- *  VBoxConsoleView::mouseEvent() calling
- *  VBoxProblemReporter::confirmInputCapture()). Instead, an attempt to
- *  close the current modal widget is done and tryClose() is rescheduled for
- *  later execution using a single-shot zero timer.
- *
- *  In particular, this method is used by updateMachineState() when the VM
- *  goes offline, which can even happen if we are inside the modal event loop,
- *  (for example, the VM has been externally powered off or the guest OS
- *  has initiated a shutdown procedure).
- */
-void VBoxConsoleWnd::tryClose()
-{
-    /* First close any open modal & popup widgets. Use a single shot with
-     * timeout 0 to allow the widgets to cleany close and test then again. If
-     * all open widgets are closed destroy ourself. */
-
-    /// #warning "port me":
-    /// @todo (r=dsen) we have to test this on windows
-
-    QWidget *widget = QApplication::activeModalWidget() ?
-                      QApplication::activeModalWidget() :
-                      QApplication::activePopupWidget() ?
-                      QApplication::activePopupWidget() : 0;
-    if (widget)
-    {
-        widget->close();
-        QTimer::singleShot (0, this, SLOT (tryClose()));
-    }
-    else
-        close();
-}
-
-/**
- *  Called (on non-UI thread!) when a global GUI setting changes.
- */
-void VBoxConsoleWnd::processGlobalSettingChange (const char * /*publicName*/,
-                                                 const char * /*name*/)
-{
-    hostkey_name->setText (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey()));
-}
+    }
+
+    mConsole->detach();
+    centralWidget()->layout()->removeWidget (mConsole);
+    delete mConsole;
+    mConsole = 0;
+    mSession.Close();
+    mSession.detach();
+
+    LogFlowFuncLeave();
+}
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
 
 /**
@@ -3666,13 +3285,12 @@
 void VBoxConsoleWnd::dbgPrepareDebugMenu()
 {
-#ifdef VBOX_WITH_DEBUGGER_GUI
     /* The "Logging" item. */
     bool fEnabled = false;
     bool fChecked = false;
-    CConsole cconsole = csession.GetConsole();
-    if (cconsole.isOk())
-    {
-        CMachineDebugger cdebugger = cconsole.GetDebugger();
-        if (cconsole.isOk())
+    CConsole console = mSession.GetConsole();
+    if (console.isOk())
+    {
+        CMachineDebugger cdebugger = console.GetDebugger();
+        if (console.isOk())
         {
             fEnabled = true;
@@ -3684,5 +3302,4 @@
     if (fChecked != mDbgLoggingAction->isChecked())
         mDbgLoggingAction->setChecked (fChecked);
-#endif /* VBOX_WITH_DEBUGGER_GUI */
 }
 
@@ -3692,8 +3309,6 @@
 void VBoxConsoleWnd::dbgShowStatistics()
 {
-#ifdef VBOX_WITH_DEBUGGER_GUI
     if (dbgCreated())
         mDbgGuiVT->pfnShowStatistics (mDbgGui);
-#endif
 }
 
@@ -3703,8 +3318,6 @@
 void VBoxConsoleWnd::dbgShowCommandLine()
 {
-#ifdef VBOX_WITH_DEBUGGER_GUI
     if (dbgCreated())
         mDbgGuiVT->pfnShowCommandLine (mDbgGui);
-#endif
 }
 
@@ -3712,19 +3325,15 @@
  * Called when the Debug->Logging menu item is selected.
  */
-void VBoxConsoleWnd::dbgLoggingToggled(bool aState)
+void VBoxConsoleWnd::dbgLoggingToggled (bool aState)
 {
     NOREF(aState);
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    CConsole cconsole = csession.GetConsole();
-    if (cconsole.isOk())
-    {
-        CMachineDebugger cdebugger = cconsole.GetDebugger();
-        if (cconsole.isOk())
-            cdebugger.SetLogEnabled(aState);
-    }
-#endif
-}
-
-#ifdef VBOX_WITH_DEBUGGER_GUI
+    CConsole console = mSession.GetConsole();
+    if (console.isOk())
+    {
+        CMachineDebugger cdebugger = console.GetDebugger();
+        if (console.isOk())
+            cdebugger.SetLogEnabled (aState);
+    }
+}
 
 /**
@@ -3744,16 +3353,16 @@
 
     PFNDBGGUICREATE pfnGuiCreate;
-    int rc = RTLdrGetSymbol (hLdrMod, "DBGGuiCreate", (void **)&pfnGuiCreate);
+    int rc = RTLdrGetSymbol (hLdrMod, "DBGGuiCreate", (void**) &pfnGuiCreate);
     if (RT_SUCCESS (rc))
     {
-        ISession *pISession = csession.raw();
+        ISession *pISession = mSession.raw();
         rc = pfnGuiCreate (pISession, &mDbgGui, &mDbgGuiVT);
         if (RT_SUCCESS (rc))
         {
-            if (    DBGGUIVT_ARE_VERSIONS_COMPATIBLE (mDbgGuiVT->u32Version, DBGGUIVT_VERSION)
-                ||  mDbgGuiVT->u32EndVersion == mDbgGuiVT->u32Version)
+            if (DBGGUIVT_ARE_VERSIONS_COMPATIBLE (mDbgGuiVT->u32Version, DBGGUIVT_VERSION) ||
+                mDbgGuiVT->u32EndVersion == mDbgGuiVT->u32Version)
             {
-                mDbgGuiVT->pfnSetParent (mDbgGui, (QWidget *)this);
-                mDbgGuiVT->pfnSetMenu (mDbgGui, (QMenu *)mDbgMenu);
+                mDbgGuiVT->pfnSetParent (mDbgGui, (QWidget*) this);
+                mDbgGuiVT->pfnSetMenu (mDbgGui, (QMenu*) mDbgMenu);
                 dbgAdjustRelativePos();
                 return true;
@@ -3769,6 +3378,6 @@
         LogRel (("RTLdrGetSymbol(,\"DBGGuiCreate\",) -> %Rrc\n", rc));
 
-    mDbgGui = NULL;
-    mDbgGuiVT = NULL;
+    mDbgGui = 0;
+    mDbgGuiVT = 0;
     return false;
 }
@@ -3782,6 +3391,6 @@
     {
         mDbgGuiVT->pfnDestroy (mDbgGui);
-        mDbgGui = NULL;
-        mDbgGuiVT = NULL;
+        mDbgGui = 0;
+        mDbgGuiVT = 0;
     }
 }
@@ -3800,4 +3409,59 @@
 
 #endif /* VBOX_WITH_DEBUGGER_GUI */
+
+VBoxStorageDialog::VBoxStorageDialog (QWidget *aParent, CSession &aSession)
+    : QIWithRetranslateUI <QDialog> (aParent)
+    , mSettings (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 button's layout */
+    QIDialogButtonBox *buttonBox = new QIDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
+
+    connect (buttonBox, SIGNAL (helpRequested()), &vboxProblem(), SLOT (showHelpHelpDialog()));
+    connect (buttonBox, SIGNAL (accepted()), this, SLOT (accept()));
+    connect (buttonBox, SIGNAL (rejected()), this, SLOT (reject()));
+    mainLayout->addWidget (buttonBox);
+
+    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::showEvent (QShowEvent *aEvent)
+{
+    resize (450, 300);
+    VBoxGlobal::centerWidget (this, parentWidget());
+    setMinimumWidth (400);
+    QDialog::showEvent (aEvent);
+}
 
 VBoxNetworkDialog::VBoxNetworkDialog (QWidget *aParent, CSession &aSession)
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp	(revision 23722)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp	(revision 23723)
@@ -1436,6 +1436,7 @@
 
 /* Storage Delegate */
-StorageDelegate::StorageDelegate (QObject *aParent)
+StorageDelegate::StorageDelegate (QObject *aParent, bool aDisableStaticControls)
     : QItemDelegate (aParent)
+    , mDisableStaticControls (aDisableStaticControls)
 {
 }
@@ -1494,5 +1495,5 @@
 
     /* Draw Controller Additions */
-    if (model->data (aIndex, StorageModel::R_IsController).toBool() && state & QStyle::State_Selected)
+    if (!mDisableStaticControls && model->data (aIndex, StorageModel::R_IsController).toBool() && state & QStyle::State_Selected)
     {
         DeviceTypeList devicesList (model->data (aIndex, StorageModel::R_CtrDevices).value <DeviceTypeList>());
@@ -1546,7 +1547,8 @@
  * Used as HD Settings widget.
  */
-VBoxVMSettingsHD::VBoxVMSettingsHD()
+VBoxVMSettingsHD::VBoxVMSettingsHD (bool aDisableStaticControls /* = false */)
     : mValidator (0)
     , mIsPolished (false)
+    , mDisableStaticControls (aDisableStaticControls)
 {
     /* Apply UI decorations */
@@ -1607,5 +1609,5 @@
     /* Storage Model/View */
     mStorageModel = new StorageModel (mTwStorageTree);
-    StorageDelegate *storageDelegate = new StorageDelegate (mTwStorageTree);
+    StorageDelegate *storageDelegate = new StorageDelegate (mTwStorageTree, mDisableStaticControls);
     mTwStorageTree->setMouseTracking (true);
     mTwStorageTree->setContextMenuPolicy (Qt::CustomContextMenu);
@@ -1621,4 +1623,5 @@
     mTbStorageBar->addAction (mAddCtrAction);
     mTbStorageBar->addAction (mDelCtrAction);
+    mTbStorageBar->setHidden (mDisableStaticControls);
 
 #ifdef Q_WS_MAC
@@ -1733,35 +1736,60 @@
 void VBoxVMSettingsHD::putBackTo()
 {
-    /* 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);
-        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);
-            CMediumAttachment attachment = mMachine.GetMediumAttachment (ctrName, attStorageSlot.port, attStorageSlot.device);
-            attachment.SetPassthrough (mStorageModel->data (attIndex, StorageModel::R_AttIsHostDrive).toBool() &&
-                                       mStorageModel->data (attIndex, StorageModel::R_AttIsPassthrough).toBool());
+    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);
+            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);
+                CMediumAttachment attachment = mMachine.GetMediumAttachment (ctrName, attStorageSlot.port, attStorageSlot.device);
+                attachment.SetPassthrough (mStorageModel->data (attIndex, StorageModel::R_AttIsHostDrive).toBool() &&
+                                           mStorageModel->data (attIndex, StorageModel::R_AttIsPassthrough).toBool());
+            }
         }
     }
@@ -1891,5 +1919,5 @@
             {
                 mStorageModel->setData (attIndex, attMediumId, StorageModel::R_AttMediumId);
-                mValidator->revalidate();
+                if (mValidator) mValidator->revalidate();
             }
         }
@@ -1910,5 +1938,5 @@
             {
                 mStorageModel->setData (attIndex, firstAvailableId, StorageModel::R_AttMediumId);
-                mValidator->revalidate();
+                if (mValidator) mValidator->revalidate();
             }
         }
@@ -1953,5 +1981,5 @@
     mStorageModel->delController (QUuid (mStorageModel->data (index, StorageModel::R_ItemId).toString()));
     emit storageChanged();
-    mValidator->revalidate();
+    if (mValidator) mValidator->revalidate();
 }
 
@@ -2002,5 +2030,5 @@
                                   QUuid (mStorageModel->data (index, StorageModel::R_ItemId).toString()));
     emit storageChanged();
-    mValidator->revalidate();
+    if (mValidator) mValidator->revalidate();
 }
 
@@ -2023,4 +2051,6 @@
                 /* Getting Controller Name */
                 mLeName->setText (mStorageModel->data (index, StorageModel::R_CtrName).toString());
+                mLbName->setEnabled (!mDisableStaticControls);
+                mLeName->setEnabled (!mDisableStaticControls);
 
                 /* Getting Controller Sub type */
@@ -2032,4 +2062,6 @@
                 int ctrPos = mCbType->findText (vboxGlobal().toString (type));
                 mCbType->setCurrentIndex (ctrPos == -1 ? 0 : ctrPos);
+                mLbType->setEnabled (!mDisableStaticControls);
+                mCbType->setEnabled (!mDisableStaticControls);
 
                 /* Showing Controller Page */
@@ -2047,8 +2079,11 @@
                 int attSlotPos = mCbSlot->findText (vboxGlobal().toString (slt));
                 mCbSlot->setCurrentIndex (attSlotPos == -1 ? 0 : attSlotPos);
+                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 */
@@ -2058,10 +2093,19 @@
                     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:
@@ -2075,5 +2119,5 @@
                 /* Getting Passthrough state */
                 bool isHostDrive = mStorageModel->data (index, StorageModel::R_AttIsHostDrive).toBool();
-                mCbPassthrough->setEnabled (isHostDrive);
+                mCbPassthrough->setEnabled (!mDisableStaticControls && isHostDrive);
                 mCbPassthrough->setChecked (isHostDrive && mStorageModel->data (index, StorageModel::R_AttIsPassthrough).toBool());
 
@@ -2098,5 +2142,5 @@
     }
 
-    mValidator->revalidate();
+    if (mValidator) mValidator->revalidate();
 
     mIsLoadingInProgress = false;
@@ -2168,17 +2212,17 @@
     bool isAttachmentsPossible = mStorageModel->data (index, StorageModel::R_IsMoreAttachmentsPossible).toBool();
 
-    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);
+    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);
 }
 
@@ -2486,5 +2530,5 @@
     mStorageModel->addAttachment (QUuid (mStorageModel->data (index, StorageModel::R_ItemId).toString()), aDevice);
     emit storageChanged();
-    mValidator->revalidate();
+    if (mValidator) mValidator->revalidate();
 }
 
