Index: /trunk/include/VBox/com/string.h
===================================================================
--- /trunk/include/VBox/com/string.h	(revision 52545)
+++ /trunk/include/VBox/com/string.h	(revision 52546)
@@ -514,7 +514,7 @@
     }
 
-    Utf8Str(CBSTR that)
-    {
-        copyFrom(that);
+    Utf8Str(CBSTR that, size_t a_cchSize = RTSTR_MAX)
+    {
+        copyFrom(that, a_cchSize);
     }
 
@@ -718,5 +718,5 @@
 protected:
 
-    void copyFrom(CBSTR a_pbstr);
+    void copyFrom(CBSTR a_pbstr, size_t a_cchSize = RTSTR_MAX);
     HRESULT copyFromEx(CBSTR a_pbstr);
     HRESULT copyFromExNComRC(const char *a_pcszSrc, size_t a_offSrc, size_t a_cchSrc);
Index: /trunk/include/iprt/cpp/ministring.h
===================================================================
--- /trunk/include/iprt/cpp/ministring.h	(revision 52545)
+++ /trunk/include/iprt/cpp/ministring.h	(revision 52546)
@@ -33,4 +33,5 @@
 
 #include <new>
+#include <utility>
 
 
@@ -876,4 +877,16 @@
     static RTCString join(const RTCList<RTCString, RTCString *> &a_rList,
                           const RTCString &a_rstrSep = "");
+
+    /* Swaps the values of the two strings.
+     * Used instead of copying when the string which
+     * is copied will no longer be needed after copying
+     * Both of two strings remain valid.
+     * The method is exception-safe */
+    inline void swap(RTCString &that) throw()
+    {
+        std::swap(m_psz, that.m_psz);
+        std::swap(m_cch, that.m_cch);
+        std::swap(m_cbAllocated, that.m_cbAllocated);
+    }
 
 protected:
Index: /trunk/src/VBox/Main/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Main/Makefile.kmk	(revision 52545)
+++ /trunk/src/VBox/Main/Makefile.kmk	(revision 52546)
@@ -345,4 +345,5 @@
 	src-all/PCIDeviceAttachmentImpl.cpp \
 	src-all/ProgressImpl.cpp \
+	src-all/QMTranslatorImpl.cpp \
 	src-all/SharedFolderImpl.cpp \
 	src-all/AutoCaller.cpp \
Index: /trunk/src/VBox/Main/glue/string.cpp
===================================================================
--- /trunk/src/VBox/Main/glue/string.cpp	(revision 52545)
+++ /trunk/src/VBox/Main/glue/string.cpp	(revision 52546)
@@ -179,8 +179,52 @@
  * @param   a_pbstr         The source string.  The caller guarantees that this
  *                          is valid UTF-16.
+ * @param   a_cbSize        The number of characters to be copied. If set to RTSTR_MAX,
+ *                          the entire string will be copied.
  *
  * @sa      RTCString::copyFromN
  */
-void Utf8Str::copyFrom(CBSTR a_pbstr)
+void Utf8Str::copyFrom(CBSTR a_pbstr, size_t a_cchSize)
+{
+    if (a_pbstr && *a_pbstr)
+    {
+        int vrc = RTUtf16ToUtf8Ex((PCRTUTF16)a_pbstr,
+                                  a_cchSize,        // size_t cwcString: translate entire string
+                                  &m_psz,           // char **ppsz: output buffer
+                                  0,                // size_t cch: if 0, func allocates buffer in *ppsz
+                                  &m_cch);          // size_t *pcch: receives the size of the output string, excluding the terminator.
+        if (RT_SUCCESS(vrc))
+            m_cbAllocated = m_cch + 1;
+        else
+        {
+            if (   vrc != VERR_NO_STR_MEMORY
+                && vrc != VERR_NO_MEMORY)
+            {
+                /* ASSUME: input is valid Utf-16. Fake out of memory error. */
+                AssertLogRelMsgFailed(("%Rrc %.*Rhxs\n", vrc, RTUtf16Len(a_pbstr) * sizeof(RTUTF16), a_pbstr));
+            }
+
+            m_cch = 0;
+            m_cbAllocated = 0;
+            m_psz = NULL;
+
+            throw std::bad_alloc();
+        }
+    }
+    else
+    {
+        m_cch = 0;
+        m_cbAllocated = 0;
+        m_psz = NULL;
+    }
+}
+
+/**
+ * A variant of Utf8Str::copyFrom that does not throw any exceptions but returns
+ * E_OUTOFMEMORY instead.
+ *
+ * @param   a_pbstr         The source string.
+ * @returns S_OK or E_OUTOFMEMORY.
+ */
+HRESULT Utf8Str::copyFromEx(CBSTR a_pbstr)
 {
     if (a_pbstr && *a_pbstr)
@@ -206,46 +250,4 @@
             m_psz = NULL;
 
-            throw std::bad_alloc();
-        }
-    }
-    else
-    {
-        m_cch = 0;
-        m_cbAllocated = 0;
-        m_psz = NULL;
-    }
-}
-
-/**
- * A variant of Utf8Str::copyFrom that does not throw any exceptions but returns
- * E_OUTOFMEMORY instead.
- *
- * @param   a_pbstr         The source string.
- * @returns S_OK or E_OUTOFMEMORY.
- */
-HRESULT Utf8Str::copyFromEx(CBSTR a_pbstr)
-{
-    if (a_pbstr && *a_pbstr)
-    {
-        int vrc = RTUtf16ToUtf8Ex((PCRTUTF16)a_pbstr,
-                                  RTSTR_MAX,        // size_t cwcString: translate entire string
-                                  &m_psz,           // char **ppsz: output buffer
-                                  0,                // size_t cch: if 0, func allocates buffer in *ppsz
-                                  &m_cch);          // size_t *pcch: receives the size of the output string, excluding the terminator.
-        if (RT_SUCCESS(vrc))
-            m_cbAllocated = m_cch + 1;
-        else
-        {
-            if (   vrc != VERR_NO_STR_MEMORY
-                && vrc != VERR_NO_MEMORY)
-            {
-                /* ASSUME: input is valid Utf-16. Fake out of memory error. */
-                AssertLogRelMsgFailed(("%Rrc %.*Rhxs\n", vrc, RTUtf16Len(a_pbstr) * sizeof(RTUTF16), a_pbstr));
-            }
-
-            m_cch = 0;
-            m_cbAllocated = 0;
-            m_psz = NULL;
-
             return E_OUTOFMEMORY;
         }
Index: /trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp	(revision 52545)
+++ /trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp	(revision 52546)
@@ -77,4 +77,6 @@
 #include "AutoCaller.h"
 #include "Logging.h"
+
+#include <QMTranslator.h>
 
 #ifdef RT_OS_WINDOWS
