Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp	(revision 45333)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp	(revision 45334)
@@ -1556,4 +1556,30 @@
 }
 
+bool UIMessageCenter::remindAboutGuruMeditation(const QString &strLogFolder)
+{
+    return messageOkCancel(mainMachineWindowShown(), MessageType_GuruMeditation,
+                           tr("<p>A critical error has occurred while running the virtual "
+                              "machine and the machine execution has been stopped.</p>"
+                              ""
+                              "<p>For help, please see the Community section on "
+                              "<a href=http://www.virtualbox.org>http://www.virtualbox.org</a> "
+                              "or your support contract. Please provide the contents of the "
+                              "log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, "
+                              "which you can find in the <nobr><b>%1</b></nobr> directory, "
+                              "as well as a description of what you were doing when this error happened. "
+                              ""
+                              "Note that you can also access the above files by selecting <b>Show Log</b> "
+                              "from the <b>Machine</b> menu of the main VirtualBox window.</p>"
+                              ""
+                              "<p>Press <b>OK</b> if you want to power off the machine "
+                              "or press <b>Ignore</b> if you want to leave it as is for debugging. "
+                              "Please note that debugging requires special knowledge and tools, "
+                              "so it is recommended to press <b>OK</b> now.</p>")
+                              .arg(strLogFolder),
+                           0 /* auto-confirm id */,
+                           QIMessageBox::tr("Ok"),
+                           QIMessageBox::tr("Ignore"));
+}
+
 bool UIMessageCenter::warnAboutVirtNotEnabled64BitsGuest(bool fHWVirtExSupported) const
 {
@@ -1810,111 +1836,51 @@
 }
 
-void UIMessageCenter::cannotAttachUSBDevice(const CConsole &console,
-                                            const QString &device)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res(console);
-
+void UIMessageCenter::cannotAttachUSBDevice(const CConsole &console, const QString &strDevice)
+{
+    /* Preserve error-info: */
+    QString strErrorInfo = formatErrorInfo(console);
+    /* Show the message: */
     message(mainMachineWindowShown(), MessageType_Error,
-        tr("Failed to attach the USB device <b>%1</b> "
-           "to the virtual machine <b>%2</b>.")
-            .arg(device)
-            .arg(console.GetMachine().GetName()),
-        formatErrorInfo(res));
-}
-
-void UIMessageCenter::cannotAttachUSBDevice(const CConsole &console,
-                                            const QString &device,
-                                            const CVirtualBoxErrorInfo &error)
+            tr("Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.")
+               .arg(strDevice, console.GetMachine().GetName()),
+            strErrorInfo);
+}
+
+void UIMessageCenter::cannotAttachUSBDevice(const CVirtualBoxErrorInfo &error, const QString &strDevice, const QString &strMachineName)
 {
     message(mainMachineWindowShown(), MessageType_Error,
-        tr("Failed to attach the USB device <b>%1</b> "
-           "to the virtual machine <b>%2</b>.")
-            .arg(device)
-            .arg(console.GetMachine().GetName()),
-        formatErrorInfo(error));
-}
-
-void UIMessageCenter::cannotDetachUSBDevice(const CConsole &console,
-                                            const QString &device)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res(console);
-
+            tr("Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.")
+               .arg(strDevice, strMachineName),
+            formatErrorInfo(error));
+}
+
+void UIMessageCenter::cannotDetachUSBDevice(const CConsole &console, const QString &strDevice)
+{
+    /* Preserve error-info: */
+    QString strErrorInfo = formatErrorInfo(console);
+    /* Show the message: */
     message(mainMachineWindowShown(), MessageType_Error,
-        tr("Failed to detach the USB device <b>%1</b> "
-           "from the virtual machine <b>%2</b>.")
-            .arg(device)
-            .arg(console.GetMachine().GetName()),
-        formatErrorInfo(res));
-}
-
-void UIMessageCenter::cannotDetachUSBDevice(const CConsole &console,
-                                            const QString &device,
-                                            const CVirtualBoxErrorInfo &error)
+            tr("Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.")
+               .arg(strDevice, console.GetMachine().GetName()),
+            strErrorInfo);
+}
+
+void UIMessageCenter::cannotDetachUSBDevice(const CVirtualBoxErrorInfo &error, const QString &strDevice, const QString &strMachineName)
 {
     message(mainMachineWindowShown(), MessageType_Error,
-        tr("Failed to detach the USB device <b>%1</b> "
-           "from the virtual machine <b>%2</b>.")
-            .arg(device)
-            .arg(console.GetMachine().GetName()),
-        formatErrorInfo(error));
-}
-
-void UIMessageCenter::remindAboutGuestAdditionsAreNotActive(QWidget *pParent)
-{
-    message(pParent, MessageType_Warning,
-             tr("<p>The VirtualBox Guest Additions do not appear to be "
-                "available on this virtual machine, and shared folders "
-                "cannot be used without them. To use shared folders inside "
-                "the virtual machine, please install the Guest Additions "
-                "if they are not installed, or re-install them if they are "
-                "not working correctly, by selecting <b>Install Guest Additions</b> "
-                "from the <b>Devices</b> menu. "
-                "If they are installed but the machine is not yet fully started "
-                "then shared folders will be available once it is.</p>"),
-             "remindAboutGuestAdditionsAreNotActive");
-}
-
-void UIMessageCenter::cannotMountGuestAdditions(const QString &strMachineName)
-{
-    message(mainMachineWindowShown(), MessageType_Error,
-             tr("<p>Could not insert the VirtualBox Guest Additions "
-                "installer CD image into the virtual machine <b>%1</b>, as the machine "
-                "has no CD/DVD-ROM drives. Please add a drive using the "
-                "storage page of the virtual machine settings dialog.</p>")
-                 .arg(strMachineName));
-}
-
-bool UIMessageCenter::remindAboutGuruMeditation(const CConsole &console, const QString &strLogFolder)
-{
-    Q_UNUSED(console);
-
-    int rc = message(mainMachineWindowShown(), MessageType_GuruMeditation,
-        tr("<p>A critical error has occurred while running the virtual "
-           "machine and the machine execution has been stopped.</p>"
-           ""
-           "<p>For help, please see the Community section on "
-           "<a href=http://www.virtualbox.org>http://www.virtualbox.org</a> "
-           "or your support contract. Please provide the contents of the "
-           "log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, "
-           "which you can find in the <nobr><b>%1</b></nobr> directory, "
-           "as well as a description of what you were doing when this error "
-           "happened. "
-           ""
-           "Note that you can also access the above files by selecting "
-           "<b>Show Log</b> from the <b>Machine</b> menu of the main "
-           "VirtualBox window.</p>"
-           ""
-           "<p>Press <b>OK</b> if you want to power off the machine "
-           "or press <b>Ignore</b> if you want to leave it as is for debugging. "
-           "Please note that debugging requires special knowledge and tools, so "
-           "it is recommended to press <b>OK</b> now.</p>")
-            .arg(strLogFolder),
-        0 /* auto-confirm id */,
-        AlertButton_Ok | AlertButtonOption_Default,
-        AlertButton_Ignore | AlertButtonOption_Escape);
-
-    return rc == AlertButton_Ok;
+            tr("Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.")
+               .arg(strDevice, strMachineName),
+            formatErrorInfo(error));
+}
+
+void UIMessageCenter::remindAboutGuestAdditionsAreNotActive(QWidget *pParent /*= 0*/)
+{
+    message(pParent ? pParent : mainMachineWindowShown(), MessageType_Warning,
+            tr("<p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, "
+               "and shared folders cannot be used without them. To use shared folders inside the virtual machine, "
+               "please install the Guest Additions if they are not installed, or re-install them if they are "
+               "not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. "
+               "If they are installed but the machine is not yet fully started then shared folders will be available once it is.</p>"),
+            "remindAboutGuestAdditionsAreNotActive");
 }
 
@@ -1971,4 +1937,14 @@
                            0 /* auto-confirm id */,
                            tr("Mount", "additions"));
+}
+
+void UIMessageCenter::cannotMountGuestAdditions(const QString &strMachineName)
+{
+    message(mainMachineWindowShown(), MessageType_Error,
+             tr("<p>Could not insert the VirtualBox Guest Additions "
+                "installer CD image into the virtual machine <b>%1</b>, as the machine "
+                "has no CD/DVD-ROM drives. Please add a drive using the "
+                "storage page of the virtual machine settings dialog.</p>")
+                 .arg(strMachineName));
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h	(revision 45333)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h	(revision 45334)
@@ -300,4 +300,5 @@
     /* API: Runtime UI warnings: */
     void showRuntimeError(const CConsole &console, bool fFatal, const QString &strErrorId, const QString &strErrorMsg) const;
+    bool remindAboutGuruMeditation(const QString &strLogFolder);
     bool warnAboutVirtNotEnabled64BitsGuest(bool fHWVirtExSupported) const;
     bool warnAboutVirtNotEnabledGuestRequired(bool fHWVirtExSupported) const;
@@ -317,13 +318,9 @@
     bool cannotSwitchScreenInFullscreen(quint64 uMinVRAM) const;
     void cannotSwitchScreenInSeamless(quint64 uMinVRAM) const;
-    void cannotAttachUSBDevice(const CConsole &console, const QString &device);
-    void cannotAttachUSBDevice(const CConsole &console, const QString &device,
-                               const CVirtualBoxErrorInfo &error);
-    void cannotDetachUSBDevice(const CConsole &console, const QString &device);
-    void cannotDetachUSBDevice(const CConsole &console, const QString &device,
-                               const CVirtualBoxErrorInfo &error);
-    void remindAboutGuestAdditionsAreNotActive(QWidget *pParent);
-    void cannotMountGuestAdditions(const QString &strMachineName);
-    bool remindAboutGuruMeditation(const CConsole &console, const QString &strLogFolder);
+    void cannotAttachUSBDevice(const CConsole &console, const QString &strDevice);
+    void cannotAttachUSBDevice(const CVirtualBoxErrorInfo &error, const QString &strDevice, const QString &strMachineName);
+    void cannotDetachUSBDevice(const CConsole &console, const QString &strDevice);
+    void cannotDetachUSBDevice(const CVirtualBoxErrorInfo &error, const QString &strDevice, const QString &strMachineName);
+    void remindAboutGuestAdditionsAreNotActive(QWidget *pParent = 0);
 
     /* API: Network management warnings: */
@@ -336,4 +333,5 @@
     bool confirmDownloadAdditions(const QString &strUrl, qulonglong uSize);
     bool confirmMountAdditions(const QString &strUrl, const QString &strSrc);
+    void cannotMountGuestAdditions(const QString &strMachineName);
     void warnAboutAdditionsCantBeSaved(const QString &strTarget);
     bool askAboutUserManualDownload(const QString &strMissedLocation);
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 45333)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 45334)
@@ -313,16 +313,26 @@
             uisession()->setGuestResizeIgnored(true);
 
-            /* Get console and log folder. */
+            /* Get variables: */
             CConsole console = session().GetConsole();
-            const QString &strLogFolder = console.GetMachine().GetLogFolder();
-
-            /* Take the screenshot for debugging purposes and save it. */
+            CMachine machine = console.GetMachine();
+            QString strMachineName = machine.GetName();
+            QString strLogFolder = machine.GetLogFolder();
+
+            /* Take the screenshot for debugging purposes: */
             takeScreenshot(strLogFolder + "/VBox.png", "png");
 
-            /* Warn the user about GURU: */
-            if (msgCenter().remindAboutGuruMeditation(console, QDir::toNativeSeparators(strLogFolder)))
+            /* Warn the user about GURU meditation: */
+            if (msgCenter().remindAboutGuruMeditation(QDir::toNativeSeparators(strLogFolder)))
             {
-                console.PowerDown();
-                if (!console.isOk())
+                /* Prepare machine power down progress: */
+                CProgress progress = console.PowerDown();
+                if (console.isOk())
+                {
+                    /* Show machine power down progress: */
+                    msgCenter().showModalProgressDialog(progress, strMachineName, ":/progress_poweroff_90px.png", activeMachineWindow());
+                    if (!progress.isOk() || progress.GetResultCode() != 0)
+                        msgCenter().cannotPowerDownMachine(progress, strMachineName);
+                }
+                else
                     msgCenter().cannotPowerDownMachine(console);
             }
@@ -418,7 +428,7 @@
     {
         if (fIsAttached)
-            msgCenter().cannotAttachUSBDevice(session().GetConsole(), vboxGlobal().details(device), error);
+            msgCenter().cannotAttachUSBDevice(error, vboxGlobal().details(device), session().GetMachine().GetName());
         else
-            msgCenter().cannotDetachUSBDevice(session().GetConsole(), vboxGlobal().details(device), error);
+            msgCenter().cannotDetachUSBDevice(error, vboxGlobal().details(device), session().GetMachine().GetName());
     }
 }
