Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h	(revision 3044)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h	(revision 3045)
@@ -133,4 +133,5 @@
         SessionStateChangeEventType,
         SnapshotEventType,
+        USBDeviceStateChangeEventType,
         RuntimeErrorEventType,
         ModifierKeyChangeEventType,
Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h	(revision 3044)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h	(revision 3045)
@@ -189,5 +189,9 @@
 
     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 cannotCreateSharedFolder (QWidget *, const CMachine &,
Index: /trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ru.ts
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ru.ts	(revision 3044)
+++ /trunk/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ru.ts	(revision 3045)
@@ -77,53 +77,53 @@
     <message>
         <source>Left Shift</source>
-        <translation type="unfinished"></translation>
+        <translation>Левый Shift</translation>
     </message>
     <message>
         <source>Right Shift</source>
-        <translation type="unfinished"></translation>
+        <translation>Правый Shift</translation>
     </message>
     <message>
         <source>Left Ctrl</source>
-        <translation type="unfinished"></translation>
+        <translation>Левый Ctrl</translation>
     </message>
     <message>
         <source>Right Ctrl</source>
-        <translation type="unfinished"></translation>
+        <translation>Правый Ctrl</translation>
     </message>
     <message>
         <source>Left Alt</source>
-        <translation type="unfinished"></translation>
+        <translation>Левый Alt</translation>
     </message>
     <message>
         <source>Right Alt</source>
-        <translation type="unfinished"></translation>
+        <translation>Правый Alt</translation>
     </message>
     <message>
         <source>Left WinKey</source>
-        <translation type="unfinished"></translation>
+        <translation>Левая Win-клавиша</translation>
     </message>
     <message>
         <source>Right WinKey</source>
-        <translation type="unfinished"></translation>
+        <translation>Правая Win-клавиша</translation>
     </message>
     <message>
         <source>Menu key</source>
-        <translation type="unfinished"></translation>
+        <translation>Клавиша Menu</translation>
     </message>
     <message>
         <source>Alt Gr</source>
-        <translation type="unfinished"></translation>
+        <translation>Alt Gr</translation>
     </message>
     <message>
         <source>Caps Lock</source>
-        <translation type="unfinished"></translation>
+        <translation>Caps Lock</translation>
     </message>
     <message>
         <source>Scroll Lock</source>
-        <translation type="unfinished"></translation>
+        <translation>Scroll Lock</translation>
     </message>
     <message>
         <source>&lt;key_%1&gt;</source>
-        <translation type="unfinished"></translation>
+        <translation>&lt;клавиша_%1&gt;</translation>
     </message>
 </context>
@@ -961,9 +961,9 @@
     <message>
         <source>CD/DVD-ROM images (*.iso);;All files (*)</source>
-        <translation type="unfinished"></translation>
+        <translation>Образы CD/DVD-ROM (*.iso);;Все файлы (*)</translation>
     </message>
     <message>
         <source>Floppy images (*.img);;All files (*)</source>
-        <translation type="unfinished"></translation>
+        <translation>Образы дискет (*.img);;Все файлы (*)</translation>
     </message>
 </context>
@@ -2421,13 +2421,13 @@
     <message>
         <source>&lt;p&gt;VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.&lt;/p&gt;&lt;p&gt;Please update Guest Additions to the current version by choosing &lt;b&gt;Install Guest Additions&lt;/b&gt; from the &lt;b&gt;Devices&lt;/b&gt; menu.&lt;/p&gt;</source>
-        <translation type="unfinished"></translation>
+        <translation type="unfinished">&lt;p&gt;В гостевой ОС обнаружен слишком старый пакет Дополнений гостевой ОС: установлена версия %1, ожидается версия %2. Некоторые возможности, требующие Дополнений гостевой ОС (интеграция мыши, авто-размер экрана гостевой ОС), скорее всего, перестанут функционировать.&lt;/p&gt;&lt;p&gt;Пожалуйста, обновите Дополнения гостевой ОС до текущей версии, выбрав пункт &lt;b&gt;Установить Дополнения гостевой ОС&lt;/b&gt; в меню &lt;b&gt;Устройства&lt;/b&gt;.&lt;/p&gt;</translation>
     </message>
     <message>
         <source>&lt;p&gt;VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.&lt;/p&gt;&lt;p&gt;It is recommended to update Guest Additions to the current version  by choosing &lt;b&gt;Install Guest Additions&lt;/b&gt; from the &lt;b&gt;Devices&lt;/b&gt; menu.&lt;/p&gt;</source>
-        <translation type="unfinished"></translation>
+        <translation type="unfinished">&lt;p&gt;В гостевой ОС обнаружен устаревший пакет Дополнений гостевой ОС: установлена версия %1, ожидается версия %2. Некоторые возможности, требующие Дополнений гостевой ОС (интеграция мыши, авто-размер экрана гостевой ОС) могут перестать функционировать.&lt;/p&gt;&lt;p&gt;Рекомендуется обновить Дополнения гостевой ОС до текущей версии, выбрав пункт &lt;b&gt;Установить Дополнения гостевой ОС&lt;/b&gt; в меню &lt;b&gt;Устройства&lt;/b&gt;.&lt;/p&gt;</translation>
     </message>
     <message>
         <source>&lt;p&gt;VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.&lt;/p&gt;&lt;p&gt;Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of Guest Additions by choosing &lt;b&gt;Install Guest Additions&lt;/b&gt; from the &lt;b&gt;Devices&lt;/b&gt; menu.&lt;/p&gt;</source>
-        <translation type="unfinished"></translation>
+        <translation type="unfinished">&lt;p&gt;В гостевой ОС обнаружен слишком новый пакет Дополнений гостевой ОС: установлена версия %1, ожидается версия %2.&lt;/p&gt;&lt;p&gt;Использованее более новой версии Дополнений с более старой версией VirtualBox не поддерживается. Пожалуйста, установите подходящую версию Дополнений гостевой ОС, выбрав пункт &lt;b&gt;Установить Дополнения гостевой ОС&lt;/b&gt; в меню &lt;b&gt;Устройства&lt;/b&gt;.&lt;/p&gt;</translation>
     </message>
 </context>
@@ -2660,9 +2660,9 @@
     <message>
         <source>Show &amp;Log...</source>
-        <translation type="unfinished"></translation>
+        <translation type="unfinished">Показать &amp;лог...</translation>
     </message>
     <message>
         <source>Show Log...</source>
-        <translation type="unfinished"></translation>
+        <translation type="unfinished">Показать лог...</translation>
     </message>
     <message>
@@ -2672,5 +2672,5 @@
     <message>
         <source>Show the log files of the selected virtual machine</source>
-        <translation type="unfinished"></translation>
+        <translation type="unfinished">Показать лог-файлы выбранной виртуальной машины</translation>
     </message>
 </context>
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp	(revision 3044)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp	(revision 3045)
@@ -278,5 +278,5 @@
 {
 public:
-    ModifierKeyChangeEvent(bool fNumLock, bool fCapsLock, bool fScrollLock) :
+    ModifierKeyChangeEvent (bool fNumLock, bool fCapsLock, bool fScrollLock) :
         QEvent ((QEvent::Type) VBoxDefs::ModifierKeyChangeEventType),
         mfNumLock (fNumLock), mfCapsLock (fCapsLock), mfScrollLock (fScrollLock) {}
@@ -286,4 +286,21 @@
 private:
     bool mfNumLock, mfCapsLock, mfScrollLock;
+};
+
+/** USB device state change event */
+class USBDeviceStateChangeEvent : public QEvent
+{
+public:
+    USBDeviceStateChangeEvent (const CUSBDevice &aDevice, bool aAttached,
+                               const CVirtualBoxErrorInfo &aError) :
+        QEvent ((QEvent::Type) VBoxDefs::USBDeviceStateChangeEventType),
+        mDevice (aDevice), mAttached (aAttached), mError (aError) {}
+    CUSBDevice device() const { return mDevice; }
+    bool attached() const { return mAttached; }
+    CVirtualBoxErrorInfo error() const { return mError; }
+private:
+    CUSBDevice mDevice;
+    bool mAttached;
+    CVirtualBoxErrorInfo mError;
 };
 
@@ -389,10 +406,9 @@
                                       IVirtualBoxErrorInfo *error)
     {
-        Q_UNUSED (device);
-        Q_UNUSED (attached);
-        Q_UNUSED (error);
-
-        /// @todo update menu entries
-
+        QApplication::postEvent (mView,
+                                 new USBDeviceStateChangeEvent (
+                                     CUSBDevice (device),
+                                     bool (attached),
+                                     CVirtualBoxErrorInfo (error)));
         return S_OK;
     }
@@ -992,4 +1008,22 @@
                 if (!destroyed && mainwnd->statusBar())
                     mainwnd->statusBar()->clear();
+
+                return true;
+            }
+
+            case VBoxDefs::USBDeviceStateChangeEventType:
+            {
+                USBDeviceStateChangeEvent *ue = (USBDeviceStateChangeEvent *)e;
+
+                if (ue->attached())
+                    vboxProblem().cannotAttachUSBDevice (
+                        cconsole,
+                        vboxGlobal().details (ue->device()), ue->error());
+                else
+                    vboxProblem().cannotDetachUSBDevice (
+                        cconsole,
+                        vboxGlobal().details (ue->device()), ue->error());
+
+                /// @todo update menu entries
 
                 return true;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp	(revision 3044)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp	(revision 3045)
@@ -1152,4 +1152,16 @@
 }
 
+void VBoxProblemReporter::cannotAttachUSBDevice (const CConsole &console,
+                                                 const QString &device,
+                                                 const CVirtualBoxErrorInfo &error)
+{
+    message (&vboxGlobal().consoleWnd(), 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 VBoxProblemReporter::cannotDetachUSBDevice (const CConsole &console,
                                                  const QString &device)
@@ -1164,4 +1176,16 @@
             .arg (console.GetMachine().GetName()),
         formatErrorInfo (res));
+}
+
+void VBoxProblemReporter::cannotDetachUSBDevice (const CConsole &console,
+                                                 const QString &device,
+                                                 const CVirtualBoxErrorInfo &error)
+{
+    message (&vboxGlobal().consoleWnd(), 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));
 }
 
Index: /trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 3044)
+++ /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 3045)
@@ -3200,5 +3200,6 @@
 
     /* VM might have been stopped when this message arrives */
-    if (mMachineState < MachineState_Running)
+    if (mMachineState < MachineState_Running ||
+        mMachineState == MachineState_Stopping)
     {
         LogFlowThisFunc (("Attach request ignored (mMachineState=%d).\n",
@@ -3209,5 +3210,5 @@
     if (aError != NULL)
     {
-        /* notify callback about an error */
+        /* notify callbacks about the error */
         onUSBDeviceStateChange (aDevice, true /* aAttached */, aError);
         return S_OK;
@@ -3233,5 +3234,18 @@
     HRESULT rc = attachUSBDevice (aDevice, pRhConfig);
 
-    /// @todo notify listeners of IConsoleCallback in case of error
+    if (FAILED (rc))
+    {
+        /* take the current error info */
+        com::ErrorInfoKeeper eik;
+        /* the error must be a VirtualBoxErrorInfo instance */
+        ComPtr <IVirtualBoxErrorInfo> error = eik.takeError();
+        Assert (!error.isNull());
+        if (!error.isNull())
+        {
+            /* notify callbacks about the error */
+            onUSBDeviceStateChange (aDevice, true /* aAttached */, error);
+        }
+    }
+
     return rc;
 }
@@ -3292,5 +3306,18 @@
     HRESULT rc = detachUSBDevice (it);
 
-    /// @todo notify listeners of IConsoleCallback in case of error
+    if (FAILED (rc))
+    {
+        /* take the current error info */
+        com::ErrorInfoKeeper eik;
+        /* the error must be a VirtualBoxErrorInfo instance */
+        ComPtr <IVirtualBoxErrorInfo> error = eik.takeError();
+        Assert (!error.isNull());
+        if (!error.isNull())
+        {
+            /* notify callbacks about the error */
+            onUSBDeviceStateChange (device, false /* aAttached */, error);
+        }
+    }
+
     return rc;
 }
