Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionsPool.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionsPool.cpp	(revision 27131)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionsPool.cpp	(revision 27132)
@@ -26,4 +26,7 @@
 #include "VBoxGlobal.h"
 
+/* Global includes */
+#include <QtGlobal>
+
 /* Action activation event */
 class ActivateActionEvent : public QEvent
@@ -957,4 +960,82 @@
 };
 
+#ifdef Q_WS_MAC
+class DockMenuAction : public UIMenuAction
+{
+    Q_OBJECT;
+
+public:
+
+    DockMenuAction(QObject *pParent)
+        : UIMenuAction(pParent)
+    {
+        retranslateUi();
+    }
+
+protected:
+
+    void retranslateUi() {}
+};
+
+class DockSettingsMenuAction : public UIMenuAction
+{
+    Q_OBJECT;
+
+public:
+
+    DockSettingsMenuAction(QObject *pParent)
+        : UIMenuAction(pParent)
+    {
+        retranslateUi();
+    }
+
+protected:
+
+    void retranslateUi()
+    {
+        setText(UIActionsPool::tr("Dock Icon"));
+    }
+};
+
+class ToggleDockPreviewMonitorAction : public UIToggleAction
+{
+    Q_OBJECT;
+
+public:
+
+    ToggleDockPreviewMonitorAction(QObject *pParent)
+        : UIToggleAction(pParent)
+    {
+        retranslateUi();
+    }
+
+protected:
+
+    void retranslateUi()
+    {
+        setText(UIActionsPool::tr("Show Monitor Preview"));
+    }
+};
+
+class ToggleDockDisableMonitorAction : public UIToggleAction
+{
+    Q_OBJECT;
+
+public:
+
+    ToggleDockDisableMonitorAction(QObject *pParent)
+        : UIToggleAction(pParent)
+    {
+        retranslateUi();
+    }
+
+protected:
+
+    void retranslateUi()
+    {
+        setText(UIActionsPool::tr("Show Application Icon"));
+    }
+};
+#endif /* Q_WS_MAC */
 
 UIActionsPool::UIActionsPool(QObject *pParent)
@@ -1003,4 +1084,10 @@
     m_actionsPool[UIActionIndex_Simple_About] = new ShowAboutAction(this);
 
+#ifdef Q_WS_MAC
+    /* "Dock" menu actions: */
+    m_actionsPool[UIActionIndex_Toggle_DockPreviewMonitor] = new ToggleDockPreviewMonitorAction(this);
+    m_actionsPool[UIActionIndex_Toggle_DockDisableMonitor] = new ToggleDockDisableMonitorAction(this);
+#endif /* Q_WS_MAC */
+
     /* Create all menus */
     createMenus();
@@ -1064,4 +1151,13 @@
         delete m_actionsPool[UIActionIndex_Menu_Help];
     m_actionsPool[UIActionIndex_Menu_Help] = new MenuHelpAction(this);
+
+#ifdef Q_WS_MAC
+    if (m_actionsPool[UIActionIndex_Menu_Dock])
+        delete m_actionsPool[UIActionIndex_Menu_Dock];
+    m_actionsPool[UIActionIndex_Menu_Dock] = new DockMenuAction(this);
+    if (m_actionsPool[UIActionIndex_Menu_DockSettings])
+        delete m_actionsPool[UIActionIndex_Menu_DockSettings];
+    m_actionsPool[UIActionIndex_Menu_DockSettings] = new DockSettingsMenuAction(this);
+#endif /* Q_WS_MAC */
 }
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionsPool.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionsPool.h	(revision 27131)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionsPool.h	(revision 27132)
@@ -106,4 +106,11 @@
     UIActionIndex_Simple_About,
 
+#ifdef Q_WS_MAC
+    UIActionIndex_Menu_Dock,
+    UIActionIndex_Menu_DockSettings,
+    UIActionIndex_Toggle_DockPreviewMonitor,
+    UIActionIndex_Toggle_DockDisableMonitor,
+#endif /* Q_WS_MAC */
+
     UIActionIndex_End
 };
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 27131)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 27132)
@@ -562,4 +562,36 @@
 #endif
 }
+
+#ifdef Q_WS_MAC
+void UIMachineLogic::prepareDock()
+{
+    QMenu *pDockMenu = actionsPool()->action(UIActionIndex_Menu_Dock)->menu();
+
+    /* Add all VM menu entries to the dock menu. Leave out close and stuff like
+     * this. */
+    QList<QAction*> actions = actionsPool()->action(UIActionIndex_Menu_Machine)->menu()->actions();
+    for (int i=0; i < actions.size(); ++i)
+        if (actions.at(i)->menuRole() == QAction::TextHeuristicRole)
+            pDockMenu->addAction(actions.at(i));
+    pDockMenu->addSeparator();
+
+    QMenu *pDockSettingsMenu = actionsPool()->action(UIActionIndex_Menu_DockSettings)->menu();
+    QActionGroup *pDockPreviewModeGroup = new QActionGroup(this);
+    QAction *pDockEnablePreviewMonitor = actionsPool()->action(UIActionIndex_Toggle_DockPreviewMonitor);
+    pDockPreviewModeGroup->addAction(pDockEnablePreviewMonitor);
+    QAction *pDockDisablePreview = actionsPool()->action(UIActionIndex_Toggle_DockDisableMonitor);
+    pDockPreviewModeGroup->addAction(pDockDisablePreview);
+    pDockSettingsMenu->addActions(pDockPreviewModeGroup->actions());
+
+    pDockMenu->addMenu(pDockSettingsMenu);
+
+    connect(pDockPreviewModeGroup, SIGNAL(triggered(QAction*)),
+            this, SLOT(sltDockPreviewModeChanged(QAction*)));
+
+    /* Add it to the dock. */
+    extern void qt_mac_set_dock_menu(QMenu *);
+    qt_mac_set_dock_menu(pDockMenu);
+}
+#endif /* Q_WS_MAC */
 
 void UIMachineLogic::prepareRequiredFeatures()
@@ -1399,4 +1431,22 @@
 #endif
 
+#ifdef Q_WS_MAC
+void UIMachineLogic::sltDockPreviewModeChanged(QAction *pAction)
+{
+//    if (mConsole)
+    {
+        CMachine machine = m_pSession->session().GetMachine();
+        if (!machine.isNull())
+        {
+            if (pAction == actionsPool()->action(UIActionIndex_Toggle_DockDisableMonitor))
+                machine.SetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled, "false");
+            else if (pAction == actionsPool()->action(UIActionIndex_Toggle_DockPreviewMonitor))
+                machine.SetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled, "true");
+//            mConsole->updateDockOverlay();
+        }
+    }
+}
+#endif /* Q_WS_MAC */
+
 void UIMachineLogic::installGuestAdditionsFrom(const QString &strSource)
 {
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h	(revision 27131)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h	(revision 27132)
@@ -34,4 +34,5 @@
 
 /* Global forwards */
+class QAction;
 class QActionGroup;
 
@@ -101,4 +102,7 @@
     virtual void prepareActionGroups();
     virtual void prepareActionConnections();
+#ifdef Q_WS_MAC
+    virtual void prepareDock();
+#endif /* Q_WS_MAC */
     virtual void prepareRequiredFeatures();
     virtual void prepareConsolePowerUp();
@@ -153,4 +157,8 @@
 #endif
 
+#ifdef Q_WS_MAC
+    void sltDockPreviewModeChanged(QAction *pAction);
+#endif /* Q_WS_MAC */
+
 private:
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp	(revision 27131)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp	(revision 27132)
@@ -144,4 +144,10 @@
         prepareMachineWindows();
 
+#ifdef Q_WS_MAC
+        /* Prepare dock: */
+        prepareDock();
+#endif /* Q_WS_MAC */
+
+
         /* Initialization: */
         sltMachineStateChanged();
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp	(revision 27131)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp	(revision 27132)
@@ -69,4 +69,9 @@
         prepareMachineWindows();
 
+#ifdef Q_WS_MAC
+        /* Prepare dock: */
+        prepareDock();
+#endif /* Q_WS_MAC */
+
         /* Initialization: */
         sltMachineStateChanged();
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp	(revision 27131)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp	(revision 27132)
@@ -134,4 +134,9 @@
         prepareMachineWindows();
 
+#ifdef Q_WS_MAC
+        /* Prepare dock: */
+        prepareDock();
+#endif /* Q_WS_MAC */
+
         /* Initialization: */
         sltMachineStateChanged();
