Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxPathSelector.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxPathSelector.h	(revision 10657)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxPathSelector.h	(revision 10658)
@@ -2,5 +2,5 @@
  *
  * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: VBoxPathSelector class declaration
+ * VirtualBox Qt extensions: VBoxFilePathSelectorWidget class declaration
  */
 
@@ -21,6 +21,6 @@
  */
 
-#ifndef __VBoxPathSelector_h__
-#define __VBoxPathSelector_h__
+#ifndef __VBoxFilePathSelectorWidget_h__
+#define __VBoxFilePathSelectorWidget_h__
 
 #include "QIWithRetranslateUI.h"
@@ -39,5 +39,5 @@
 class QComboBox;
 
-class VBoxPathSelector: public QIWithRetranslateUI<QWidget>
+class VBoxFilePathSelectorWidget: public QIWithRetranslateUI<QWidget>
 {
     Q_OBJECT;
@@ -45,6 +45,15 @@
 public:
 
-    VBoxPathSelector (QWidget *aParent = NULL);
-    ~VBoxPathSelector();
+    enum SelectorMode 
+    { 
+        PathMode = 0,
+        FileMode
+    };
+
+    VBoxFilePathSelectorWidget (QWidget *aParent = NULL);
+    ~VBoxFilePathSelectorWidget();
+
+    void setMode (SelectorMode aMode);
+    SelectorMode mode() const;
 
     void setLineEditWhatsThis (const QString &aText);
@@ -75,8 +84,12 @@
 
     void init();
+    QIcon defaultIcon() const;
+    QString filePath (const QString &aName, bool bLast) const;
 
     /* Private member vars */
-    QString mPath;
-    QString mNoneStr;
+    SelectorMode mMode;
+    QString      mPath;
+    QString      mNoneStr;
+
 #ifdef VBOX_USE_COMBOBOX_PATH_SELECTOR
     QComboBox   *mCbPath;
@@ -91,4 +104,4 @@
 };
 
-#endif /* __VBoxPathSelector_h__ */
+#endif /* __VBoxFilePathSelectorWidget_h__ */
 
Index: trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGLSettingsGeneral.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGLSettingsGeneral.cpp	(revision 10657)
+++ trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGLSettingsGeneral.cpp	(revision 10658)
@@ -31,11 +31,13 @@
     Ui::VBoxGLSettingsGeneral::setupUi (this);
 
+    mPsVRDP->setMode (VBoxFilePathSelectorWidget::FileMode);
+
     /* Setup connections */
-    connect (mTbVdiSelect, SIGNAL (clicked()), this, SLOT (onSelectFolderClicked()));
-    connect (mTbMachSelect, SIGNAL (clicked()), this, SLOT (onSelectFolderClicked()));
-    connect (mTbVRDPSelect, SIGNAL (clicked()), this, SLOT (onSelectFolderClicked()));
-    connect (mTbVdiReset, SIGNAL (clicked()), this, SLOT (onResetFolderClicked()));
-    connect (mTbMachReset, SIGNAL (clicked()), this, SLOT (onResetFolderClicked()));
-    connect (mTbVRDPReset, SIGNAL (clicked()), this, SLOT (onResetFolderClicked()));
+    connect (mPsVdi,  SIGNAL (selectPath()), this, SLOT (onSelectFolderClicked()));
+    connect (mPsMach, SIGNAL (selectPath()), this, SLOT (onSelectFolderClicked()));
+    connect (mPsVRDP, SIGNAL (selectPath()), this, SLOT (onSelectFolderClicked()));
+    connect (mPsVdi,  SIGNAL (resetPath()), this, SLOT (onResetFolderClicked()));
+    connect (mPsMach, SIGNAL (resetPath()), this, SLOT (onResetFolderClicked()));
+    connect (mPsVRDP, SIGNAL (resetPath()), this, SLOT (onResetFolderClicked()));
 
     /* Applying language settings */
@@ -46,7 +48,7 @@
                                          const VBoxGlobalSettings &)
 {
-    mLeVdi->setText (aProps.GetDefaultVDIFolder());
-    mLeMach->setText (aProps.GetDefaultMachineFolder());
-    mLeVRDP->setText (aProps.GetRemoteDisplayAuthLibrary());
+    mPsVdi->setPath (aProps.GetDefaultVDIFolder());
+    mPsMach->setPath (aProps.GetDefaultMachineFolder());
+    mPsVRDP->setPath (aProps.GetRemoteDisplayAuthLibrary());
 }
 
@@ -54,23 +56,17 @@
                                            VBoxGlobalSettings &)
 {
-    if (mLeVdi->isModified())
-        aProps.SetDefaultVDIFolder (mLeVdi->text());
-    if (aProps.isOk() && mLeMach->isModified())
-        aProps.SetDefaultMachineFolder (mLeMach->text());
-    if (mLeVRDP->isModified())
-        aProps.SetRemoteDisplayAuthLibrary (mLeVRDP->text());
+    if (mPsVdi->isModified())
+        aProps.SetDefaultVDIFolder (mPsVdi->path());
+    if (aProps.isOk() && mPsMach->isModified())
+        aProps.SetDefaultMachineFolder (mPsMach->path());
+    if (mPsVdi->isModified())
+        aProps.SetRemoteDisplayAuthLibrary (mPsVRDP->path());
 }
 
 void VBoxGLSettingsGeneral::setOrderAfter (QWidget *aWidget)
 {
-    setTabOrder (aWidget, mLeVdi);
-    setTabOrder (mLeVdi, mTbVdiSelect);
-    setTabOrder (mTbVdiSelect, mTbVdiReset);
-    setTabOrder (mTbVdiReset, mLeMach);
-    setTabOrder (mLeMach, mTbMachSelect);
-    setTabOrder (mTbMachSelect, mTbMachReset);
-    setTabOrder (mTbMachReset, mLeVRDP);
-    setTabOrder (mLeVRDP, mTbVRDPSelect);
-    setTabOrder (mTbVRDPSelect, mTbVRDPReset);
+    setTabOrder (aWidget, mPsVdi);
+    setTabOrder (mPsVdi, mPsMach);
+    setTabOrder (mPsMach, mPsVRDP);
 }
 
@@ -79,39 +75,36 @@
     /* Translate uic generated strings */
     Ui::VBoxGLSettingsGeneral::retranslateUi (this);
+
+    mPsVdi->setLineEditWhatsThis (tr ("Displays the path to the default VDI folder. This folder is used, if not explicitly specified otherwise, when adding existing or creating new virtual hard disks."));
+    mPsVdi->setSelectorWhatsThis (tr ("Opens a dialog to select the default VDI folder."));
+    mPsVdi->setResetWhatsThis (tr ("Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again."));
+
+    mPsMach->setLineEditWhatsThis (tr ("Displays the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines."));
+    mPsMach->setSelectorWhatsThis (tr ("Opens a dialog to select the default virtual machine folder."));
+    mPsMach->setResetWhatsThis (tr ("Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again."));
+
+    mPsVRDP->setLineEditWhatsThis (tr ("Displays the path to the library that provides authentication for Remote Display (VRDP) clients."));
+    mPsVRDP->setSelectorWhatsThis (tr ("Opens a dialog to select the VRDP authentication library file."));
+    mPsVRDP->setResetWhatsThis (tr ("Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again."));
 }
 
 void VBoxGLSettingsGeneral::onResetFolderClicked()
 {
-    QToolButton *tb = qobject_cast<QToolButton*> (sender());
-    Assert (tb);
-
-    QLineEdit *le = 0;
-    if (tb == mTbVdiReset) le = mLeVdi;
-    else if (tb == mTbMachReset) le = mLeMach;
-    else if (tb == mTbVRDPReset) le = mLeVRDP;
-    Assert (le);
-
-    /* Do this instead of le->setText (QString::null) to cause
-     * isModified() return true */
-    le->selectAll();
-    le->del();
+    VBoxFilePathSelectorWidget *ps = qobject_cast<VBoxFilePathSelectorWidget*> (sender());
+    Assert (ps);
+    ps->setPath ("");
 }
 
 void VBoxGLSettingsGeneral::onSelectFolderClicked()
 {
-    QToolButton *tb = qobject_cast<QToolButton*> (sender());
-    Assert (tb);
+    VBoxFilePathSelectorWidget *ps = qobject_cast<VBoxFilePathSelectorWidget*> (sender());
+    Assert (ps);
 
-    QLineEdit *le = 0;
-    if (tb == mTbVdiSelect) le = mLeVdi;
-    else if (tb == mTbMachSelect) le = mLeMach;
-    else if (tb == mTbVRDPSelect) le = mLeVRDP;
-    Assert (le);
-
-    QString initDir = VBoxGlobal::getFirstExistingDir (le->text());
+    QString initDir = VBoxGlobal::getFirstExistingDir (ps->path());
     if (initDir.isNull())
         initDir = vboxGlobal().virtualBox().GetHomeFolder();
 
-    QString path = le == mLeVRDP ?
+
+    QString path = ps == mPsVRDP ?
         VBoxGlobal::getOpenFileName (initDir, QString::null, this, QString::null) :
         VBoxGlobal::getExistingDirectory (initDir, this);
@@ -123,8 +116,5 @@
     path.remove (QRegExp ("[\\\\/]$"));
 
-    /* Do this instead of le->setText (QString::null) to cause
-     * isModified() return true */
-    le->selectAll();
-    le->insert (path);
+    ps->setPath (path);
 }
 
Index: trunk/src/VBox/Frontends/VirtualBox4/src/VBoxPathSelector.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/src/VBoxPathSelector.cpp	(revision 10657)
+++ trunk/src/VBox/Frontends/VirtualBox4/src/VBoxPathSelector.cpp	(revision 10658)
@@ -2,5 +2,5 @@
  *
  * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: VBoxPathSelector class implementation
+ * VirtualBox Qt extensions: VBoxFilePathSelectorWidget class implementation
  */
 
@@ -43,16 +43,27 @@
 };
 
-VBoxPathSelector::VBoxPathSelector (QWidget *aParent /* = NULL */)
+VBoxFilePathSelectorWidget::VBoxFilePathSelectorWidget (QWidget *aParent /* = NULL */)
     : QIWithRetranslateUI<QWidget> (aParent)
+    , mMode (PathMode)
 {
     init();
 }
 
-VBoxPathSelector::~VBoxPathSelector()
+VBoxFilePathSelectorWidget::~VBoxFilePathSelectorWidget()
 {
     delete mIconProvider;
 }
 
-void VBoxPathSelector::setLineEditWhatsThis (const QString &aText)
+void VBoxFilePathSelectorWidget::setMode (SelectorMode aMode)
+{
+    mMode = aMode;
+}
+
+VBoxFilePathSelectorWidget::SelectorMode VBoxFilePathSelectorWidget::mode() const
+{
+    return mMode;
+}
+
+void VBoxFilePathSelectorWidget::setLineEditWhatsThis (const QString &aText)
 {
 #ifdef VBOX_USE_COMBOBOX_PATH_SELECTOR
@@ -63,5 +74,5 @@
 }
 
-void VBoxPathSelector::setSelectorWhatsThis (const QString &aText)
+void VBoxFilePathSelectorWidget::setSelectorWhatsThis (const QString &aText)
 {
 #ifdef VBOX_USE_COMBOBOX_PATH_SELECTOR
@@ -72,5 +83,5 @@
 }
 
-void VBoxPathSelector::setResetWhatsThis (const QString &aText)
+void VBoxFilePathSelectorWidget::setResetWhatsThis (const QString &aText)
 {
 #ifdef VBOX_USE_COMBOBOX_PATH_SELECTOR
@@ -81,5 +92,5 @@
 }
 
-bool VBoxPathSelector::isModified() const
+bool VBoxFilePathSelectorWidget::isModified() const
 {
 #ifdef VBOX_USE_COMBOBOX_PATH_SELECTOR
@@ -90,5 +101,5 @@
 }
 
-void VBoxPathSelector::setPath (const QString &aPath)
+void VBoxFilePathSelectorWidget::setPath (const QString &aPath)
 {
     mPath = aPath;
@@ -99,10 +110,9 @@
         icon = mIconProvider->icon (fi);
     else
-        icon = mIconProvider->icon (QFileIconProvider::Folder);
+        icon = defaultIcon();
     if (tmpPath.isEmpty())
         tmpPath = mNoneStr;
 #ifdef VBOX_USE_COMBOBOX_PATH_SELECTOR
-    QDir dir (tmpPath);
-    mCbPath->setItemText (PathId, dir.dirName());
+    mCbPath->setItemText (PathId, filePath (tmpPath, true));
     mCbPath->setItemIcon (PathId, icon);
 #else /* VBOX_USE_COMBOBOX_PATH_SELECTOR */
@@ -110,15 +120,15 @@
      * isModified() return true */
     mLePath->selectAll();
-    mLePath->insert (tmpPath);
+    mLePath->insert (filePath (tmpPath, false));
     mLbIcon->setPixmap (icon.pixmap (16, 16));
 #endif /* !VBOX_USE_COMBOBOX_PATH_SELECTOR */
 }
 
-QString VBoxPathSelector::path() const
+QString VBoxFilePathSelectorWidget::path() const
 {
     return mPath;
 }
 
-void VBoxPathSelector::retranslateUi()
+void VBoxFilePathSelectorWidget::retranslateUi()
 {
 #ifdef VBOX_USE_COMBOBOX_PATH_SELECTOR
@@ -129,5 +139,5 @@
 }
 
-void VBoxPathSelector::cbActivated (int aIndex)
+void VBoxFilePathSelectorWidget::cbActivated (int aIndex)
 {
 #ifdef VBOX_USE_COMBOBOX_PATH_SELECTOR
@@ -151,5 +161,5 @@
 }
 
-void VBoxPathSelector::init()
+void VBoxFilePathSelectorWidget::init()
 {
     mIconProvider = new QFileIconProvider();
@@ -158,4 +168,5 @@
 #ifdef VBOX_USE_COMBOBOX_PATH_SELECTOR
     mCbPath = new QComboBox();
+    mCbPath->setMinimumWidth (200);
     mCbPath->insertItem (PathId, "");
     mCbPath->insertItem (SelectId, "");
@@ -167,4 +178,5 @@
     mLbIcon = new QLabel();
     mLePath = new QLineEdit();
+    mLePath->setMinimumWidth (180);
     mLePath->setReadOnly (true);
     mTbSelect = new QToolButton();
@@ -188,2 +200,30 @@
 }
 
+QIcon VBoxFilePathSelectorWidget::defaultIcon() const
+{
+    if (mMode == PathMode)
+        return mIconProvider->icon (QFileIconProvider::Folder);
+    else
+        return mIconProvider->icon (QFileIconProvider::File);
+}  
+
+QString VBoxFilePathSelectorWidget::filePath (const QString &aName, bool bLast) const
+{
+    if (mMode == PathMode)
+    {
+        QDir dir (aName);
+        if (bLast)
+            return dir.dirName();
+        else
+            return dir.path();
+    }
+    else
+    {
+        QFileInfo fi (aName);
+        if (bLast)
+            return fi.fileName();
+        else
+            return fi.filePath();
+    }
+}  
+
Index: trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxGLSettingsGeneral.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxGLSettingsGeneral.ui	(revision 10657)
+++ trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxGLSettingsGeneral.ui	(revision 10658)
@@ -23,6 +23,6 @@
     <x>0</x>
     <y>0</y>
-    <width>363</width>
-    <height>144</height>
+    <width>377</width>
+    <height>162</height>
    </rect>
   </property>
@@ -49,46 +49,10 @@
      </property>
      <property name="buddy" >
-      <cstring>mLeVdi</cstring>
+      <cstring>mPsVdi</cstring>
      </property>
     </widget>
    </item>
    <item row="0" column="1" >
-    <widget class="QLineEdit" name="mLeVdi" >
-     <property name="sizePolicy" >
-      <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="whatsThis" >
-      <string>Displays the path to the default VDI folder. This folder is used, if not explicitly specified otherwise, when adding existing or creating new virtual hard disks.</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="2" >
-    <widget class="QToolButton" name="mTbVdiSelect" >
-     <property name="whatsThis" >
-      <string>Opens a dialog to select the default VDI folder.</string>
-     </property>
-     <property name="icon" >
-      <iconset resource="../VirtualBox.qrc" >:/select_file_16px.png</iconset>
-     </property>
-     <property name="autoRaise" >
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="3" >
-    <widget class="QToolButton" name="mTbVdiReset" >
-     <property name="whatsThis" >
-      <string>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</string>
-     </property>
-     <property name="icon" >
-      <iconset resource="../VirtualBox.qrc" >:/eraser_16px.png</iconset>
-     </property>
-     <property name="autoRaise" >
-      <bool>true</bool>
-     </property>
-    </widget>
+    <widget class="VBoxFilePathSelectorWidget" native="1" name="mPsVdi" />
    </item>
    <item row="1" column="0" >
@@ -101,42 +65,12 @@
      </property>
      <property name="buddy" >
-      <cstring>mLeMach</cstring>
+      <cstring>mPsMach</cstring>
      </property>
     </widget>
    </item>
    <item row="1" column="1" >
-    <widget class="QLineEdit" name="mLeMach" >
-     <property name="whatsThis" >
-      <string>Displays the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.</string>
-     </property>
-    </widget>
+    <widget class="VBoxFilePathSelectorWidget" native="1" name="mPsMach" />
    </item>
-   <item row="1" column="2" >
-    <widget class="QToolButton" name="mTbMachSelect" >
-     <property name="whatsThis" >
-      <string>Opens a dialog to select the default virtual machine folder.</string>
-     </property>
-     <property name="icon" >
-      <iconset resource="../VirtualBox.qrc" >:/select_file_16px.png</iconset>
-     </property>
-     <property name="autoRaise" >
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="3" >
-    <widget class="QToolButton" name="mTbMachReset" >
-     <property name="whatsThis" >
-      <string>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</string>
-     </property>
-     <property name="icon" >
-      <iconset resource="../VirtualBox.qrc" >:/eraser_16px.png</iconset>
-     </property>
-     <property name="autoRaise" >
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="0" colspan="4" >
+   <item row="2" column="0" colspan="2" >
     <widget class="Line" name="line" >
      <property name="orientation" >
@@ -154,40 +88,10 @@
      </property>
      <property name="buddy" >
-      <cstring>mLeVRDP</cstring>
+      <cstring>mPsVRDP</cstring>
      </property>
     </widget>
    </item>
    <item row="3" column="1" >
-    <widget class="QLineEdit" name="mLeVRDP" >
-     <property name="whatsThis" >
-      <string>Displays the path to the library that provides authentication for Remote Display (VRDP) clients.</string>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="2" >
-    <widget class="QToolButton" name="mTbVRDPSelect" >
-     <property name="whatsThis" >
-      <string>Opens a dialog to select the VRDP authentication library file.</string>
-     </property>
-     <property name="icon" >
-      <iconset resource="../VirtualBox.qrc" >:/select_file_16px.png</iconset>
-     </property>
-     <property name="autoRaise" >
-      <bool>true</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="3" >
-    <widget class="QToolButton" name="mTbVRDPReset" >
-     <property name="whatsThis" >
-      <string>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again.</string>
-     </property>
-     <property name="icon" >
-      <iconset resource="../VirtualBox.qrc" >:/eraser_16px.png</iconset>
-     </property>
-     <property name="autoRaise" >
-      <bool>true</bool>
-     </property>
-    </widget>
+    <widget class="VBoxFilePathSelectorWidget" native="1" name="mPsVRDP" />
    </item>
    <item row="4" column="1" >
@@ -206,4 +110,12 @@
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>VBoxFilePathSelectorWidget</class>
+   <extends>QWidget</extends>
+   <header>VBoxPathSelector.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <resources>
   <include location="../VirtualBox.qrc" />
Index: trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsGeneral.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsGeneral.ui	(revision 10657)
+++ trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsGeneral.ui	(revision 10658)
@@ -852,5 +852,5 @@
        </item>
        <item row="4" column="1" >
-        <widget class="VBoxPathSelector" native="1" name="mPsSnapshot" />
+        <widget class="VBoxFilePathSelectorWidget" native="1" name="mPsSnapshot" />
        </item>
        <item row="5" column="1" >
@@ -977,7 +977,7 @@
   </customwidget>
   <customwidget>
-   <class>VBoxPathSelector</class>
+   <class>VBoxFilePathSelectorWidget</class>
    <extends>QWidget</extends>
-   <header>VBoxPathSelector.h</header>
+   <header>VBoxFilePathSelectorWidget.h</header>
    <container>1</container>
   </customwidget>
