Index: /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 36589)
@@ -458,4 +458,5 @@
 	src/extensions/QIWidgetValidator.cpp \
 	src/extensions/QIWizard.cpp \
+	src/settings/UISettingsDefs.cpp \
 	src/settings/UISettingsDialog.cpp \
 	src/settings/UISettingsDialogSpecific.cpp \
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h	(revision 36589)
@@ -99,13 +99,4 @@
     };
 
-    /** Settings dialog types: */
-    enum SettingsDialogType
-    {
-        SettingsDialogType_Wrong,
-        SettingsDialogType_Offline,
-        SettingsDialogType_Saved,
-        SettingsDialogType_Runtime
-    };
-
     static const char* GUI_LastWindowPosition;
     static const char* GUI_LastNormalWindowPosition;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 36589)
@@ -964,5 +964,5 @@
     /* Prepare VM settings dialog: */
     UISettingsDialog *pDlg = new UISettingsDialogMachine(defaultMachineWindow()->machineWindow(),
-                                                         VBoxDefs::SettingsDialogType_Runtime,
+                                                         SettingsDialogType_Online,
                                                          sharedMachine, session().GetConsole(),
                                                          strCategory, QString());
Index: /trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp	(revision 36589)
@@ -595,5 +595,5 @@
     CSystemProperties props = vboxGlobal().virtualBox().GetSystemProperties();
 
-    UISettingsDialog *dlg = new UISettingsDialogGlobal(this, VBoxDefs::SettingsDialogType_Offline);
+    UISettingsDialog *dlg = new UISettingsDialogGlobal(this, SettingsDialogType_Offline);
     dlg->getFrom();
 
@@ -723,13 +723,11 @@
     AssertMsgReturnVoid(pItem, ("Item must be always selected here"));
 
-    VBoxDefs::SettingsDialogType dialogType = pItem->machineState() == KMachineState_Saved ? VBoxDefs::SettingsDialogType_Saved :
-                                              pItem->sessionState() == KSessionState_Unlocked ? VBoxDefs::SettingsDialogType_Offline :
-                                              VBoxDefs::SettingsDialogType_Runtime;
-
-    CSession session = vboxGlobal().openSession(pItem->id(), dialogType != VBoxDefs::SettingsDialogType_Offline /* connect to existing? */);
-    AssertMsgReturn(!session.isNull(), ("Session must not be null"), (void)0);
+    SettingsDialogType dialogType = machineStateToSettingsDialogType(pItem->machineState());
+
+    CSession session = vboxGlobal().openSession(pItem->id(), dialogType != SettingsDialogType_Offline /* connect to existing? */);
+    AssertMsgReturnVoid(!session.isNull(), ("Session must not be null"));
     CMachine machine = session.GetMachine();
-    AssertMsgReturn(!machine.isNull(), ("Machine must not be null"), (void)0);
-    CConsole console = dialogType == VBoxDefs::SettingsDialogType_Offline ? CConsole() : session.GetConsole();
+    AssertMsgReturnVoid(!machine.isNull(), ("Machine must not be null"));
+    CConsole console = dialogType == SettingsDialogType_Offline ? CConsole() : session.GetConsole();
 
     /* Don't show the inaccessible warning if the user open the vm settings: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.cpp	(revision 36589)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.cpp	(revision 36589)
@@ -0,0 +1,49 @@
+/* $Id$ */
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * UISettingsDefs implementation
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/* VBox includes: */
+#include "UISettingsDefs.h"
+
+/* Using declarations: */
+using namespace UISettingsDefs;
+
+/* Machine state => Settings dialog type converter: */
+SettingsDialogType UISettingsDefs::machineStateToSettingsDialogType(KMachineState machineState)
+{
+    SettingsDialogType result = SettingsDialogType_Wrong;
+    switch (machineState)
+    {
+        case KMachineState_PoweredOff:
+        case KMachineState_Teleported:
+        case KMachineState_Aborted:
+            result = SettingsDialogType_Offline;
+            break;
+        case KMachineState_Saved:
+            result = SettingsDialogType_Saved;
+            break;
+        case KMachineState_Running:
+        case KMachineState_Paused:
+            result = SettingsDialogType_Online;
+            break;
+        default:
+            break;
+    }
+    return result;
+}
+
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.h	(revision 36589)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.h	(revision 36589)
@@ -0,0 +1,42 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * Header with definitions and functions related to settings dialog
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef __UISettingsDefs_h__
+#define __UISettingsDefs_h__
+
+/* VBox includes: */
+#include "COMDefs.h"
+
+/* Settings dialog namespace: */
+namespace UISettingsDefs
+{
+    /* Settings dialog types: */
+    enum SettingsDialogType
+    {
+        SettingsDialogType_Wrong,
+        SettingsDialogType_Offline,
+        SettingsDialogType_Saved,
+        SettingsDialogType_Online
+    };
+
+    /* Machine state => Settings dialog type converter: */
+    SettingsDialogType machineStateToSettingsDialogType(KMachineState machineState);
+}
+
+#endif /* __UISettingsDefs_h__ */
+
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp	(revision 36589)
@@ -42,5 +42,5 @@
 
 /* Settings Dialog Constructor: */
-UISettingsDialog::UISettingsDialog(QWidget *pParent, VBoxDefs::SettingsDialogType dialogType)
+UISettingsDialog::UISettingsDialog(QWidget *pParent, SettingsDialogType settingsDialogType)
     /* Parent class: */
     : QIWithRetranslateUI<QIMainDialog>(pParent)
@@ -49,5 +49,5 @@
     , m_pStack(0)
     /* Common variables: */
-    , m_dialogType(dialogType)
+    , m_dialogType(settingsDialogType)
     , m_fPolished(false)
     /* Loading stuff: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h	(revision 36589)
@@ -20,11 +20,11 @@
 #define __UISettingsDialog_h__
 
-/* Local includes */
+/* VBox includes: */
 #include "QIMainDialog.h"
 #include "QIWithRetranslateUI.h"
 #include "UISettingsDialog.gen.h"
-#include "VBoxDefs.h"
+#include "UISettingsDefs.h"
 
-/* Forward declarations */
+/* Forward declarations: */
 class QIWidgetValidator;
 class QStackedWidget;
@@ -33,4 +33,7 @@
 class VBoxSettingsSelector;
 class UISettingsPage;
+
+/* Using declarations: */
+using namespace UISettingsDefs;
 
 /* Base dialog class for both Global & VM settings which encapsulates most of their similar functionalities */
@@ -42,5 +45,5 @@
 
     /* Settings Dialog Constructor/Destructor: */
-    UISettingsDialog(QWidget *pParent, VBoxDefs::SettingsDialogType dialogType);
+    UISettingsDialog(QWidget *pParent, SettingsDialogType settingsDialogType);
    ~UISettingsDialog();
 
@@ -66,5 +69,5 @@
 
     /* Dialog type: */
-    VBoxDefs::SettingsDialogType dialogType() { return m_dialogType; }
+    SettingsDialogType dialogType() { return m_dialogType; }
     /* Dialog title: */
     virtual QString title() const = 0;
@@ -110,5 +113,5 @@
 
     /* Global Flags: */
-    VBoxDefs::SettingsDialogType m_dialogType;
+    SettingsDialogType m_dialogType;
     bool m_fPolished;
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp	(revision 36589)
@@ -27,4 +27,5 @@
 /* Local includes */
 #include "UISettingsDialogSpecific.h"
+#include "UISettingsDefs.h"
 #include "VBoxGlobal.h"
 #include "VBoxProblemReporter.h"
@@ -288,6 +289,6 @@
 UISettingsSerializer* UISettingsSerializer::m_pInstance = 0;
 
-UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent, VBoxDefs::SettingsDialogType type)
-    : UISettingsDialog(pParent, type)
+UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent, SettingsDialogType settingsDialogType)
+    : UISettingsDialog(pParent, settingsDialogType)
 {
     /* Window icon: */
@@ -507,8 +508,8 @@
 }
 
-UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, VBoxDefs::SettingsDialogType type,
+UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, SettingsDialogType settingsDialogType,
                                                  const CMachine &machine, const CConsole &console,
                                                  const QString &strCategory, const QString &strControl)
-    : UISettingsDialog(pParent, type)
+    : UISettingsDialog(pParent, settingsDialogType)
     , m_machine(machine)
     , m_console(console)
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h	(revision 36589)
@@ -43,5 +43,5 @@
     };
 
-    UISettingsDialogGlobal(QWidget *pParent, VBoxDefs::SettingsDialogType type);
+    UISettingsDialogGlobal(QWidget *pParent, SettingsDialogType settingsDialogType);
 
 protected:
@@ -82,5 +82,5 @@
     };
 
-    UISettingsDialogMachine(QWidget *pParent, VBoxDefs::SettingsDialogType type,
+    UISettingsDialogMachine(QWidget *pParent, SettingsDialogType settingsDialogType,
                             const CMachine &machine, const CConsole &console,
                             const QString &strCategory, const QString &strControl);
@@ -110,4 +110,5 @@
     CMachine m_machine;
     CConsole m_console;
+
     bool m_fAllowResetFirstRunFlag;
     bool m_fResetFirstRunFlag;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.cpp	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.cpp	(revision 36589)
@@ -24,5 +24,5 @@
 UISettingsPage::UISettingsPage(UISettingsPageType pageType)
     : m_pageType(pageType)
-    , m_dialogType(VBoxDefs::SettingsDialogType_Wrong)
+    , m_dialogType(SettingsDialogType_Wrong)
     , m_cId(-1)
     , m_fPolished(false)
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h	(revision 36589)
@@ -27,5 +27,5 @@
 #include "QIWithRetranslateUI.h"
 #include "COMDefs.h"
-#include "VBoxDefs.h"
+#include "UISettingsDefs.h"
 #include "VBoxGlobalSettings.h"
 
@@ -33,4 +33,7 @@
 class QIWidgetValidator;
 class QShowEvent;
+
+/* Using declarations: */
+using namespace UISettingsDefs;
 
 /* Settings page types: */
@@ -96,9 +99,9 @@
 
     /* Settings dialog type stuff: */
-    VBoxDefs::SettingsDialogType dialogType() const { return m_dialogType; }
-    virtual void setDialogType(VBoxDefs::SettingsDialogType dialogType) { m_dialogType = dialogType; }
-    bool isMachineOffline() const { return dialogType() == VBoxDefs::SettingsDialogType_Offline; }
-    bool isMachineSaved() const { return dialogType() == VBoxDefs::SettingsDialogType_Saved; }
-    bool isMachineOnline() const { return dialogType() == VBoxDefs::SettingsDialogType_Runtime; }
+    SettingsDialogType dialogType() const { return m_dialogType; }
+    virtual void setDialogType(SettingsDialogType settingsDialogType) { m_dialogType = settingsDialogType; }
+    bool isMachineOffline() const { return dialogType() == SettingsDialogType_Offline; }
+    bool isMachineSaved() const { return dialogType() == SettingsDialogType_Saved; }
+    bool isMachineOnline() const { return dialogType() == SettingsDialogType_Online; }
     bool isMachineInValidMode() const { return isMachineOffline() || isMachineSaved() || isMachineOnline(); }
 
@@ -130,5 +133,5 @@
     /* Private variables: */
     UISettingsPageType m_pageType;
-    VBoxDefs::SettingsDialogType m_dialogType;
+    SettingsDialogType m_dialogType;
     int m_cId;
     bool m_fPolished;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp	(revision 36589)
@@ -701,5 +701,5 @@
 }
 
-void UIMachineSettingsSF::setDialogType(VBoxDefs::SettingsDialogType settingsDialogType)
+void UIMachineSettingsSF::setDialogType(SettingsDialogType settingsDialogType)
 {
     UISettingsPageMachine::setDialogType(settingsDialogType);
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h	(revision 36589)
@@ -104,5 +104,5 @@
     SFoldersNameList usedList (bool aIncludeSelected);
 
-    void setDialogType(VBoxDefs::SettingsDialogType settingsDialogType);
+    void setDialogType(SettingsDialogType settingsDialogType);
 
     UISharedFolderType m_type;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp	(revision 36589)
@@ -766,5 +766,5 @@
     , mToolTipType (DefaultToolTip)
     , m_chipsetType(KChipsetType_PIIX3)
-    , m_dialogType(VBoxDefs::SettingsDialogType_Wrong)
+    , m_dialogType(SettingsDialogType_Wrong)
 {
 }
@@ -936,5 +936,5 @@
         case R_IsMoreIDEControllersPossible:
         {
-            return (m_dialogType == VBoxDefs::SettingsDialogType_Offline) &&
+            return (m_dialogType == SettingsDialogType_Offline) &&
                    (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_IDE) <
                     vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_IDE));
@@ -942,5 +942,5 @@
         case R_IsMoreSATAControllersPossible:
         {
-            return (m_dialogType == VBoxDefs::SettingsDialogType_Offline) &&
+            return (m_dialogType == SettingsDialogType_Offline) &&
                    (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_SATA) <
                     vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_SATA));
@@ -948,5 +948,5 @@
         case R_IsMoreSCSIControllersPossible:
         {
-            return (m_dialogType == VBoxDefs::SettingsDialogType_Offline) &&
+            return (m_dialogType == SettingsDialogType_Offline) &&
                    (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_SCSI) <
                     vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_SCSI));
@@ -954,5 +954,5 @@
         case R_IsMoreFloppyControllersPossible:
         {
-            return (m_dialogType == VBoxDefs::SettingsDialogType_Offline) &&
+            return (m_dialogType == SettingsDialogType_Offline) &&
                    (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_Floppy) <
                     vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_Floppy));
@@ -960,5 +960,5 @@
         case R_IsMoreSASControllersPossible:
         {
-            return (m_dialogType == VBoxDefs::SettingsDialogType_Offline) &&
+            return (m_dialogType == SettingsDialogType_Offline) &&
                    (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_SAS) <
                     vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_SAS));
@@ -972,5 +972,5 @@
                     ControllerItem *ctr = static_cast <ControllerItem*> (item);
                     CSystemProperties sp = vboxGlobal().virtualBox().GetSystemProperties();
-                    return (m_dialogType == VBoxDefs::SettingsDialogType_Offline) &&
+                    return (m_dialogType == SettingsDialogType_Offline) &&
                            ((uint)rowCount(aIndex) < sp.GetMaxPortCountForStorageBus(ctr->ctrBusType()) *
                                                      sp.GetMaxDevicesPerPortForStorageBus(ctr->ctrBusType()));
@@ -1420,5 +1420,5 @@
 }
 
-void StorageModel::setDialogType(VBoxDefs::SettingsDialogType dialogType)
+void StorageModel::setDialogType(SettingsDialogType dialogType)
 {
     m_dialogType = dialogType;
@@ -1901,5 +1901,5 @@
     {
         /* Here come the properties which could be changed only in offline state: */
-        case VBoxDefs::SettingsDialogType_Offline:
+        case SettingsDialogType_Offline:
         {
             /* Remove currently present controllers & attachments */
@@ -1976,5 +1976,5 @@
         }
         /* Here come the properties which could be changed at runtime too: */
-        case VBoxDefs::SettingsDialogType_Runtime:
+        case SettingsDialogType_Online:
         {
             /* Iterate all the controllers and update changed CD/DVD and floppy attachments: */
@@ -3066,5 +3066,5 @@
 }
 
-void UIMachineSettingsStorage::setDialogType(VBoxDefs::SettingsDialogType settingsDialogType)
+void UIMachineSettingsStorage::setDialogType(SettingsDialogType settingsDialogType)
 {
     UISettingsPageMachine::setDialogType(settingsDialogType);
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h	(revision 36588)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h	(revision 36589)
@@ -503,5 +503,5 @@
     void setChipsetType(KChipsetType type);
 
-    void setDialogType(VBoxDefs::SettingsDialogType dialogType);
+    void setDialogType(SettingsDialogType dialogType);
 
     QMap<KStorageBus, int> currentControllerTypes() const;
@@ -523,5 +523,5 @@
 
     KChipsetType m_chipsetType;
-    VBoxDefs::SettingsDialogType m_dialogType;
+    SettingsDialogType m_dialogType;
 };
 Q_DECLARE_METATYPE (StorageModel::ToolTipType);
@@ -673,5 +673,5 @@
     void addRecentMediumActions(QMenu *pOpenMediumMenu, VBoxDefs::MediumType recentMediumType);
 
-    void setDialogType(VBoxDefs::SettingsDialogType settingsDialogType);
+    void setDialogType(SettingsDialogType settingsDialogType);
     void polishPage();
 
