Index: trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp	(revision 51035)
+++ trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp	(revision 51038)
@@ -1,11 +1,9 @@
 /* $Id$ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIExtraDataManager class implementation
+ * VBox Qt GUI - UIExtraDataManager class implementation.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -32,110 +30,139 @@
 #include "CEventSource.h"
 
-class UIExtraDataEventHandler: public QObject
+
+/** QObject extension
+  * notifying UIExtraDataManager whenever any of extra-data values changed. */
+class UIExtraDataEventHandler : public QObject
 {
     Q_OBJECT;
 
+signals:
+
+    /** Notifies about GUI language change. */
+    void sigLanguageChange(QString strLanguage);
+
+    /** Notifies about Selector UI keyboard shortcut change. */
+    void sigSelectorUIShortcutChange();
+    /** Notifies about Runtime UI keyboard shortcut change. */
+    void sigRuntimeUIShortcutChange();
+
+    /** Notifies about HID LED sync state change. */
+    void sigHIDLedsSyncStateChange(bool fEnabled);
+#ifdef RT_OS_DARWIN
+    /** Mac OS X: Notifies about 'presentation mode' status change. */
+    void sigPresentationModeChange(bool fEnabled);
+    /** Mac OS X: Notifies about 'dock icon' appearance change. */
+    void sigDockIconAppearanceChange(bool fEnabled);
+#endif /* RT_OS_DARWIN */
+
 public:
 
-    UIExtraDataEventHandler(QObject *pParent = 0)
-        : QObject(pParent)
-    {}
+    /** Extra-data event-handler constructor. */
+    UIExtraDataEventHandler(QObject *pParent);
 
 public slots:
 
-    void sltExtraDataCanChange(QString strId, QString strKey, QString strValue, bool &fVeto, QString &strVetoReason)
-    {
-        if (QUuid(strId).isNull())
-        {
-            /* it's a global extra data key someone wants to change */
-            if (strKey.startsWith("GUI/"))
+    /** Handles extra-data 'can change' event: */
+    void sltExtraDataCanChange(QString strMachineID, QString strKey, QString strValue, bool &fVeto, QString &strVetoReason);
+    /** Handles extra-data 'change' event: */
+    void sltExtraDataChange(QString strMachineID, QString strKey, QString strValue);
+
+private:
+
+    /** Protects sltExtraDataChange. */
+    QMutex m_mutex;
+};
+
+UIExtraDataEventHandler::UIExtraDataEventHandler(QObject *pParent)
+    : QObject(pParent)
+{}
+
+void UIExtraDataEventHandler::sltExtraDataCanChange(QString strMachineID, QString strKey, QString strValue, bool &fVeto, QString &strVetoReason)
+{
+    /* Global extra-data 'can change' event: */
+    if (QUuid(strMachineID).isNull())
+    {
+        /* It's a global extra-data key someone wants to change: */
+        if (strKey.startsWith("GUI/"))
+        {
+            /* Try to set the global setting to check its syntax: */
+            VBoxGlobalSettings gs(false /* non-null */);
+            /* Known GUI property key? */
+            if (gs.setPublicProperty(strKey, strValue))
             {
-                /* Try to set the global setting to check its syntax */
-                VBoxGlobalSettings gs(false /* non-null */);
-                if (gs.setPublicProperty (strKey, strValue))
+                /* But invalid GUI property value? */
+                if (!gs)
                 {
-                    /* this is a known GUI property key */
-                    if (!gs)
-                    {
-                        strVetoReason = gs.lastError();
-                        /* disallow the change when there is an error*/
-                        fVeto = true;
-                    }
-                    return;
+                    /* Remember veto reason: */
+                    strVetoReason = gs.lastError();
+                    /* And disallow that change: */
+                    fVeto = true;
                 }
+                return;
             }
         }
     }
-
-    void sltExtraDataChange(QString strId, QString strKey, QString strValue)
-    {
-        if (QUuid(strId).isNull())
-        {
-            if (strKey.startsWith ("GUI/"))
+}
+
+void UIExtraDataEventHandler::sltExtraDataChange(QString strMachineID, QString strKey, QString strValue)
+{
+    /* Global extra-data 'change' event: */
+    if (QUuid(strMachineID).isNull())
+    {
+        if (strKey.startsWith("GUI/"))
+        {
+            /* Language changed? */
+            if (strKey == GUI_LanguageId)
+                emit sigLanguageChange(strValue);
+            /* Selector UI shortcut changed? */
+            else if (strKey == GUI_Input_SelectorShortcuts && gActionPool->type() == UIActionPoolType_Selector)
+                emit sigSelectorUIShortcutChange();
+            /* Runtime UI shortcut changed? */
+            else if (strKey == GUI_Input_MachineShortcuts && gActionPool->type() == UIActionPoolType_Runtime)
+                emit sigRuntimeUIShortcutChange();
+#ifdef Q_WS_MAC
+            /* 'Presentation mode' status changed? */
+            else if (strKey == GUI_PresentationModeEnabled)
             {
-                if (strKey == GUI_LanguageId)
-                    emit sigGUILanguageChange(strValue);
-                if (strKey == GUI_Input_SelectorShortcuts && gActionPool->type() == UIActionPoolType_Selector)
-                    emit sigSelectorShortcutsChanged();
-                if (strKey == GUI_Input_MachineShortcuts && gActionPool->type() == UIActionPoolType_Runtime)
-                    emit sigMachineShortcutsChanged();
-#ifdef Q_WS_MAC
-                if (strKey == GUI_PresentationModeEnabled)
-                {
-                    /* Default to true if it is an empty value */
-                    QString testStr = strValue.toLower();
-                    bool f = (testStr.isEmpty() || testStr == "false");
-                    emit sigPresentationModeChange(f);
-                }
-#endif /* Q_WS_MAC */
-
-                m_mutex.lock();
-                vboxGlobal().settings().setPublicProperty(strKey, strValue);
-                m_mutex.unlock();
-                Assert(!!vboxGlobal().settings());
-            }
-        }
-        else if (vboxGlobal().isVMConsoleProcess())
-        {
-            /* Take care about HID LEDs sync */
-            if (strKey == GUI_HidLedsSync)
-            {
-                /* If extra data GUI/HidLedsSync is not present in VM config or set
-                 * to 1 then sync is enabled. Otherwise, it is disabled. */
-                bool f = (strValue.isEmpty() || strValue == "1") ? true : false;
-                emit sigHidLedsSyncStateChanged(f);
-            }
-
-#ifdef Q_WS_MAC
-            /* Check for the currently running machine */
-            if (strId == vboxGlobal().managedVMUuid())
-            {
-                if (   strKey == GUI_RealtimeDockIconUpdateEnabled
-                    || strKey == GUI_RealtimeDockIconUpdateMonitor)
-                {
-                    bool f = strValue.toLower() == "false" ? false : true;
-                    emit sigDockIconAppearanceChange(f);
-                }
+                // TODO: Make it global..
+                /* Allowed what is not restricted: */
+                bool fEnabled = strValue.isEmpty() || strValue.toLower() != "false";
+                emit sigPresentationModeChange(fEnabled);
             }
 #endif /* Q_WS_MAC */
-        }
-    }
-
-signals:
-
-    void sigGUILanguageChange(QString strLang);
-    void sigSelectorShortcutsChanged();
-    void sigMachineShortcutsChanged();
-    void sigHidLedsSyncStateChanged(bool fEnabled);
-#ifdef RT_OS_DARWIN
-    void sigPresentationModeChange(bool fEnabled);
-    void sigDockIconAppearanceChange(bool fEnabled);
-#endif /* RT_OS_DARWIN */
-
-private:
-
-    /** protects #OnExtraDataChange() */
-    QMutex m_mutex;
-};
+
+            /* Apply global property: */
+            m_mutex.lock();
+            vboxGlobal().settings().setPublicProperty(strKey, strValue);
+            m_mutex.unlock();
+            AssertMsgReturnVoid(!!vboxGlobal().settings(), ("Failed to apply global property.\n"));
+        }
+    }
+    /* Make sure event came for the currently running VM: */
+    else if (   vboxGlobal().isVMConsoleProcess()
+             && strMachineID == vboxGlobal().managedVMUuid())
+    {
+        /* HID LEDs sync state changed? */
+        if (strKey == GUI_HidLedsSync)
+        {
+            /* Allowed what is not restricted: */
+            // TODO: Make it global..
+            bool fEnabled = strValue.isEmpty() || strValue != "0";
+            emit sigHIDLedsSyncStateChange(fEnabled);
+        }
+#ifdef Q_WS_MAC
+        /* 'Dock icon' appearance changed? */
+        else if (   strKey == GUI_RealtimeDockIconUpdateEnabled
+                 || strKey == GUI_RealtimeDockIconUpdateMonitor)
+        {
+            /* Allowed what is not restricted: */
+            // TODO: Make it global..
+            bool fEnabled = strValue.isEmpty() || strValue.toLower() != "false";
+            emit sigDockIconAppearanceChange(fEnabled);
+        }
+#endif /* Q_WS_MAC */
+    }
+}
+
 
 /* static */
@@ -145,6 +172,8 @@
 UIExtraDataManager* UIExtraDataManager::instance()
 {
+    /* Create instance if not yet exists: */
     if (!m_pInstance)
         m_pInstance = new UIExtraDataManager();
+    /* Return instance: */
     return m_pInstance;
 }
@@ -153,4 +182,5 @@
 void UIExtraDataManager::destroy()
 {
+    /* Destroy instance if still exists: */
     if (m_pInstance)
     {
@@ -161,53 +191,53 @@
 
 UIExtraDataManager::UIExtraDataManager()
-  : m_pHandler(new UIExtraDataEventHandler(this))
-{
-//    RTPrintf("Self add: %RTthrd\n", RTThreadSelf());
+    : m_pHandler(new UIExtraDataEventHandler(this))
+{
+    /* Register Main event-listener:  */
     const CVirtualBox &vbox = vboxGlobal().virtualBox();
     ComObjPtr<UIMainEventListenerImpl> pListener;
     pListener.createObject();
-    pListener->init(new UIMainEventListener(), this);
-    m_mainEventListener = CEventListener(pListener);
+    pListener->init(new UIMainEventListener, this);
+    m_listener = CEventListener(pListener);
     QVector<KVBoxEventType> events;
     events
         << KVBoxEventType_OnExtraDataCanChange
         << KVBoxEventType_OnExtraDataChanged;
-
-    vbox.GetEventSource().RegisterListener(m_mainEventListener, events, TRUE);
+    vbox.GetEventSource().RegisterListener(m_listener, events, TRUE);
     AssertWrapperOk(vbox);
 
-    /* This is a vetoable event, so we have to respond to the event and have to
-     * use a direct connection therefor. */
+    /* This is a vetoable event, so we have to respond to the event and have to use a direct connection therefor: */
     connect(pListener->getWrapped(), SIGNAL(sigExtraDataCanChange(QString, QString, QString, bool&, QString&)),
             m_pHandler, SLOT(sltExtraDataCanChange(QString, QString, QString, bool&, QString&)),
             Qt::DirectConnection);
-
-    /* Use a direct connection to the helper class. */
+    /* Use a direct connection to the helper class: */
     connect(pListener->getWrapped(), SIGNAL(sigExtraDataChange(QString, QString, QString)),
             m_pHandler, SLOT(sltExtraDataChange(QString, QString, QString)),
             Qt::DirectConnection);
 
-    /* UI signals */
-    connect(m_pHandler, SIGNAL(sigGUILanguageChange(QString)),
-            this, SIGNAL(sigGUILanguageChange(QString)),
-            Qt::QueuedConnection);
-
-    connect(m_pHandler, SIGNAL(sigSelectorShortcutsChanged()),
-            this, SIGNAL(sigSelectorShortcutsChanged()),
-            Qt::QueuedConnection);
-
-    connect(m_pHandler, SIGNAL(sigMachineShortcutsChanged()),
-            this, SIGNAL(sigMachineShortcutsChanged()),
-            Qt::QueuedConnection);
-
-    connect(m_pHandler, SIGNAL(sigHidLedsSyncStateChanged(bool)),
-            this, SIGNAL(sigHidLedsSyncStateChanged(bool)),
+    /* Language change signal: */
+    connect(m_pHandler, SIGNAL(sigLanguageChange(QString)),
+            this, SIGNAL(sigLanguageChange(QString)),
+            Qt::QueuedConnection);
+
+    /* Selector/Runtime UI shortcut change signals: */
+    connect(m_pHandler, SIGNAL(sigSelectorUIShortcutChange()),
+            this, SIGNAL(sigSelectorUIShortcutChange()),
+            Qt::QueuedConnection);
+    connect(m_pHandler, SIGNAL(sigRuntimeUIShortcutChange()),
+            this, SIGNAL(sigRuntimeUIShortcutChange()),
+            Qt::QueuedConnection);
+
+    /* HID LED sync state change signal: */
+    connect(m_pHandler, SIGNAL(sigHIDLedsSyncStateChange(bool)),
+            this, SIGNAL(sigHIDLedsSyncStateChange(bool)),
             Qt::QueuedConnection);
 
 #ifdef Q_WS_MAC
+    /* 'Presentation mode' status change signal: */
     connect(m_pHandler, SIGNAL(sigPresentationModeChange(bool)),
             this, SIGNAL(sigPresentationModeChange(bool)),
             Qt::QueuedConnection);
 
+    /* 'Dock icon' appearance change signal: */
     connect(m_pHandler, SIGNAL(sigDockIconAppearanceChange(bool)),
             this, SIGNAL(sigDockIconAppearanceChange(bool)),
@@ -218,7 +248,9 @@
 UIExtraDataManager::~UIExtraDataManager()
 {
+    /* Unregister Main event-listener:  */
     const CVirtualBox &vbox = vboxGlobal().virtualBox();
-    vbox.GetEventSource().UnregisterListener(m_mainEventListener);
+    vbox.GetEventSource().UnregisterListener(m_listener);
 }
 
 #include "UIExtraDataManager.moc"
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h	(revision 51035)
+++ trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h	(revision 51038)
@@ -4,5 +4,5 @@
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -27,33 +27,55 @@
 class UIExtraDataEventHandler;
 
-class UIExtraDataManager: public QObject
+/** Singleton QObject extension
+  * providing GUI with corresponding extra-data values,
+  * and notifying it whenever any of those values changed. */
+class UIExtraDataManager : public QObject
 {
     Q_OBJECT;
 
-public:
-    static UIExtraDataManager* instance();
-    static void destroy();
+signals:
 
-signals:
-    /* Specialized extra data signals */
-    void sigGUILanguageChange(QString strLang);
-    void sigSelectorShortcutsChanged();
-    void sigMachineShortcutsChanged();
-    void sigHidLedsSyncStateChanged(bool fEnabled);
+    /** Notifies about GUI language change. */
+    void sigLanguageChange(QString strLanguage);
+
+    /** Notifies about Selector UI keyboard shortcut change. */
+    void sigSelectorUIShortcutChange();
+    /** Notifies about Runtime UI keyboard shortcut change. */
+    void sigRuntimeUIShortcutChange();
+
+    /** Notifies about HID LED sync state change. */
+    void sigHIDLedsSyncStateChange(bool fEnabled);
+
 #ifdef RT_OS_DARWIN
+    /** Mac OS X: Notifies about 'presentation mode' status change. */
     void sigPresentationModeChange(bool fEnabled);
+    /** Mac OS X: Notifies about 'dock icon' appearance change. */
     void sigDockIconAppearanceChange(bool fEnabled);
 #endif /* RT_OS_DARWIN */
 
+public:
+
+    /** Static Extra-data Manager instance/constructor. */
+    static UIExtraDataManager* instance();
+    /** Static Extra-data Manager destructor. */
+    static void destroy();
+
 private:
+
+    /** Extra-data Manager constructor. */
     UIExtraDataManager();
+    /** Extra-data Manager destructor. */
     ~UIExtraDataManager();
 
-    /* Private member vars */
+    /** Singleton Extra-data Manager instance. */
     static UIExtraDataManager *m_pInstance;
-    CEventListener m_mainEventListener;
+
+    /** Main event-listener instance. */
+    CEventListener m_listener;
+    /** Extra-data event-handler instance. */
     UIExtraDataEventHandler *m_pHandler;
 };
 
+/** Singleton Extra-data Manager 'official' name. */
 #define gEDataManager UIExtraDataManager::instance()
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.cpp	(revision 51035)
+++ trunk/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.cpp	(revision 51038)
@@ -223,6 +223,6 @@
 {
     /* Connect to extra-data signals: */
-    connect(gEDataManager, SIGNAL(sigSelectorShortcutsChanged()), this, SLOT(sltReloadSelectorShortcuts()));
-    connect(gEDataManager, SIGNAL(sigMachineShortcutsChanged()), this, SLOT(sltReloadMachineShortcuts()));
+    connect(gEDataManager, SIGNAL(sigSelectorUIShortcutChange()), this, SLOT(sltReloadSelectorShortcuts()));
+    connect(gEDataManager, SIGNAL(sigRuntimeUIShortcutChange()), this, SLOT(sltReloadMachineShortcuts()));
 }
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 51035)
+++ trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 51038)
@@ -4413,5 +4413,5 @@
     retranslateUi();
 
-    connect(gEDataManager, SIGNAL(sigGUILanguageChange(QString)),
+    connect(gEDataManager, SIGNAL(sigLanguageChange(QString)),
             this, SLOT(sltGUILanguageChange(QString)));
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 51035)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 51038)
@@ -657,5 +657,5 @@
     /* Subscribe to GUI_HidLedsSync extradata changes in order to
      * be able to enable or disable feature dynamically. */
-    connect(gEDataManager, SIGNAL(sigHidLedsSyncStateChanged(bool)), this, SLOT(sltHidLedsSyncStateChanged(bool)));
+    connect(gEDataManager, SIGNAL(sigHIDLedsSyncStateChange(bool)), this, SLOT(sltHidLedsSyncStateChanged(bool)));
 #else
     m_isHidLedsSyncEnabled = false;
