Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileTable.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileTable.cpp	(revision 71179)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileTable.cpp	(revision 71181)
@@ -21,30 +21,21 @@
 
 /* Qt includes: */
-// # include <QAbstractItemModel>
-// # include <QHBoxLayout>
-// # include <QPlainTextEdit>
-// # include <QPushButton>
-// # include <QSplitter>
 # include <QHeaderView>
 # include <QVBoxLayout>
 
 /* GUI includes: */
-// # include "QILabel.h"
-// # include "QILineEdit.h"
-// # include "QIWithRetranslateUI.h"
-// # include "UIExtraDataManager.h"
+# include "QILineEdit.h"
 # include "UIGuestControlFileTable.h"
-// # include "UIVMInformationDialog.h"
-// # include "VBoxGlobal.h"
 
 /* COM includes: */
-// # include "CGuest.h"
 # include "CFsObjInfo.h"
 # include "CGuestDirectory.h"
-// # include "CGuestSessionStateChangedEvent.h"
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 
+/*********************************************************************************************************************************
+*   UIFileTableItem definition.                                                                                                  *
+*********************************************************************************************************************************/
 
 class UIFileTableItem
@@ -63,15 +54,33 @@
     UIFileTableItem *parentItem();
 
+    bool isDirectory() const;
+    bool isOpened() const;
+
+    void setIsDirectory(bool flag);
+    void setIsOpened(bool flag);
+
+    const QString  &path() const;
+    void setPath(const QString &path);
+
+    /** True if this is directory and name is ".." */
+    bool isUpDirectory() const;
+
 private:
     QList<UIFileTableItem*> m_childItems;
-    QList<QVariant> m_itemData;
+    QList<QVariant>  m_itemData;
     UIFileTableItem *m_parentItem;
+    bool             m_bIsDirectory;
+    bool             m_bIsOpened;
+    QString          m_strPath;
 };
 
 
 UIFileTableItem::UIFileTableItem(const QList<QVariant> &data, UIFileTableItem *parent)
-{
-    m_parentItem = parent;
-    m_itemData = data;
+    : m_itemData(data)
+    , m_parentItem(parent)
+    , m_bIsDirectory(false)
+    , m_bIsOpened(false)
+{
+
 }
 
@@ -119,5 +128,47 @@
 }
 
-
+bool UIFileTableItem::isDirectory() const
+{
+    return m_bIsDirectory;
+}
+
+bool UIFileTableItem::isOpened() const
+{
+    return m_bIsOpened;
+}
+
+void UIFileTableItem::setIsDirectory(bool flag)
+{
+    m_bIsDirectory = flag;
+}
+
+void UIFileTableItem::setIsOpened(bool flag)
+{
+    m_bIsOpened = flag;
+}
+
+const QString  &UIFileTableItem::path() const
+{
+    return m_strPath;
+}
+
+void UIFileTableItem::setPath(const QString &path)
+{
+    m_strPath = path;
+}
+
+bool UIFileTableItem::isUpDirectory() const
+{
+    if (!m_bIsDirectory)
+        return false;
+    if (data(0) == QString(".."))
+        return true;
+    return false;
+}
+
+
+/*********************************************************************************************************************************
+*   UIGuestControlFileModel implementation.                                                                                      *
+*********************************************************************************************************************************/
 
 UIGuestControlFileModel::UIGuestControlFileModel(QObject *parent)
@@ -159,11 +210,25 @@
     if (!index.isValid())
         return QVariant();
-
-    if (role != Qt::DisplayRole)
+    UIFileTableItem *item = static_cast<UIFileTableItem*>(index.internalPointer());
+    if (!item)
         return QVariant();
 
-    UIFileTableItem *item = static_cast<UIFileTableItem*>(index.internalPointer());
-
-    return item->data(index.column());
+    if (role == Qt::DisplayRole)
+    {
+        /* dont show anything but the name for up directories: */
+        if (item->isUpDirectory() && index.column() != 0)
+            return QVariant();
+        return item->data(index.column());
+    }
+
+    if (role == Qt::DecorationRole && index.column() == 0)
+    {
+        if (item->isDirectory() && !item->isUpDirectory())
+            return QIcon(":/sf_32px.png");
+        if (!item->isDirectory())
+            return QIcon(":/vm_open_filemanager_16px");
+    }
+
+    return QVariant();
 }
 
@@ -210,4 +275,5 @@
         return QModelIndex();
 }
+
 
 QModelIndex UIGuestControlFileModel::parent(const QModelIndex &index) const
@@ -244,11 +310,16 @@
 }
 
-UIGuestControlFileView::UIGuestControlFileView(QWidget *pParent /*= 0*/)
-    :QTableView(pParent)
-{
-    setShowGrid(false);
-    setSelectionBehavior(QAbstractItemView::SelectRows);
-    verticalHeader()->setVisible(false);
-}
+QModelIndex UIGuestControlFileModel::rootIndex() const
+{
+    if (!rootItem())
+        return QModelIndex();
+    return createIndex(rootItem()->child(0)->row(), 0,
+                       rootItem()->child(0));
+}
+
+
+/*********************************************************************************************************************************
+*   UIGuestControlFileTable implementation.                                                                                      *
+*********************************************************************************************************************************/
 
 UIGuestControlFileTable::UIGuestControlFileTable(QWidget *pParent /* = 0 */)
@@ -257,5 +328,8 @@
     , m_pView(0)
     , m_pModel(0)
+    , m_pTree(0)
     , m_pMainLayout(0)
+    , m_pCurrentLocationEdit(0)
+
 {
     prepareObjects();
@@ -276,10 +350,23 @@
     setLayout(m_pMainLayout);
 
+    m_pCurrentLocationEdit = new QILineEdit;
+    if(m_pCurrentLocationEdit)
+    {
+        m_pMainLayout->addWidget(m_pCurrentLocationEdit);
+        m_pCurrentLocationEdit->setReadOnly(true);
+    }
+
     m_pModel = new UIGuestControlFileModel(this);
     if (!m_pModel)
         return;
-    m_pView = new UIGuestControlFileView;
+
+
+    m_pView = new QTableView;
     if (m_pView)
     {
+        m_pView->setShowGrid(false);
+        m_pView->setSelectionBehavior(QAbstractItemView::SelectRows);
+        m_pView->verticalHeader()->setVisible(false);
+
         m_pMainLayout->addWidget(m_pView);
         m_pView->setModel(m_pModel);
@@ -287,7 +374,36 @@
 }
 
+void UIGuestControlFileTable::updateCurrentLocationEdit(const QString& strLocation)
+{
+    if (!m_pCurrentLocationEdit)
+        return;
+    m_pCurrentLocationEdit->setText(strLocation);
+}
+
+void UIGuestControlFileTable::changeLocation(const QModelIndex &index)
+{
+    if(!index.isValid() || !m_pView)
+        return;
+    m_pView->setRootIndex(index);
+    m_pView->clearSelection();
+
+    UIFileTableItem *item = static_cast<UIFileTableItem*>(index.internalPointer());
+    if(item)
+    {
+        updateCurrentLocationEdit(item->path());
+    }
+    m_pModel->signalUpdate();
+}
+
+
+/*********************************************************************************************************************************
+*   UIGuestFileTable implementation.                                                                                             *
+*********************************************************************************************************************************/
+
 UIGuestFileTable::UIGuestFileTable(QWidget *pParent /*= 0*/)
     :UIGuestControlFileTable(pParent)
 {
+    connect(m_pView, &QTableView::doubleClicked,
+            this, &UIGuestFileTable::sltItemDoubleClicked);
 }
 
@@ -303,20 +419,20 @@
         delete m_pRootItem;
 
-    QList<QVariant> rootData;
-    rootData << "Name" << "Size";
-    m_pRootItem = new UIFileTableItem(rootData);
-
-    // for(int i = 0; i < 10; ++i)
-    // {
-    //     QList<QVariant> data;
-    //     data << "some name" << 23432;
-    //     UIFieTableItem *item = new UIFileTableItem(data, m_pRootItem);
-    //     m_pRootItem->appendChild(item);
-    //     if (i == 4)
-
-    // }
-
+    QList<QVariant> headData;
+    headData << "Name" << "Size";
+    m_pRootItem = new UIFileTableItem(headData);
+
+    QList<QVariant> startDirData;
+    startDirData << "/" << 4096;
+    UIFileTableItem* startItem = new UIFileTableItem(startDirData, m_pRootItem);
+    startItem->setPath("/");
+    m_pRootItem->appendChild(startItem);
+
+    startItem->setIsDirectory(true);
+    startItem->setIsOpened(false);
     /* Read the root directory and get the list: */
-    readDirectory("/", m_pRootItem);
+
+    readDirectory("/", startItem);
+    m_pView->setRootIndex(m_pModel->rootIndex());
     m_pModel->signalUpdate();
 }
@@ -326,4 +442,6 @@
 
 {
+    if (!parent)
+        return;
     CGuestDirectory directory;
     QVector<KDirectoryOpenFlag> flag;
@@ -331,4 +449,6 @@
 
     directory = m_comGuestSession.DirectoryOpen(strPath, /*aFilter*/ "", flag);
+    parent->setIsOpened(true);
+
     if (directory.isOk())
     {
@@ -341,14 +461,23 @@
             QList<QVariant> data;
             data << fsInfo.GetName() << static_cast<qulonglong>(fsInfo.GetObjectSize());
-            UIFileTableItem *item = new UIFileTableItem(data, m_pRootItem);
-            //parent->appendChild(item);
+            UIFileTableItem *item = new UIFileTableItem(data, parent);
+            item->setPath(QString("%1%3%2").arg(strPath).arg("/").arg(fsInfo.GetName()));
             if (fsInfo.GetType() == KFsObjType_Directory)
+            {
                 directories.insert(fsInfo.GetName(), item);
+                item->setIsDirectory(true);
+                item->setIsOpened(false);
+            }
             else
+            {
                 files.insert(fsInfo.GetName(), item);
+                item->setIsDirectory(false);
+                item->setIsOpened(false);
+            }
             fsInfo = directory.Read();
         }
         insertToTree(directories, parent);
         insertToTree(files, parent);
+        updateCurrentLocationEdit(strPath);
     }
 }
@@ -363,46 +492,29 @@
     }
 }
-//     if (!treeParent || treeParent->depth() - startDepth >= iMaxDepth || strPath.isEmpty())
-//         return;
-//     QVector<KDirectoryOpenFlag> flag;
-//     flag.push_back(KDirectoryOpenFlag_None);
-//     CGuestDirectory directory;
-//     directory = m_comGuestSession.DirectoryOpen(strPath, /*aFilter*/ "", flag);
-//     treeParent->setIsOpened(true);
-//     if (directory.isOk())
-//     {
-//         CFsObjInfo fsInfo = directory.Read();
-//         while (fsInfo.isOk())
-//         {
-//             if (fsInfo.GetName() != "."
-//                 && fsInfo.GetName() != "..")
-//             {
-//                 QString path(strPath);
-//                 if (path.at(path.length() -1 ) != '/')
-//                     path.append(QString("/").append(fsInfo.GetName()));
-//                 else
-//                     path.append(fsInfo.GetName());
-//                 UIGuestControlFileTreeItem *treeItem =
-//                     new UIGuestControlFileTreeItem(treeParent, treeParent->depth() + 1 /*depth */,
-//                                                    path, getFsObjInfoStringList<CFsObjInfo>(fsInfo));
-//                 if (fsInfo.GetType() == KFsObjType_Directory)
-//                 {
-//                     treeItem->setIsDirectory(true);
-//                     treeItem->setIcon(0, QIcon(":/sf_32px.png"));
-//                     treeItem->setIsOpened(false);
-//                     readDirectory(path, treeItem, startDepth, iMaxDepth);
-//                 }
-//                 else
-//                 {
-//                     treeItem->setIsDirectory(false);
-//                     treeItem->setIsOpened(false);
-//                     treeItem->setIcon(0, QIcon(":/vm_open_filemanager_16px"));
-//                     treeItem->setHidden(true);
-//                 }
-//             }
-
-//             fsInfo = directory.Read();
-//         }
-//         directory.Close();
-//     }
-// }
+
+void UIGuestFileTable::sltItemDoubleClicked(const QModelIndex &index)
+{
+    if (!index.isValid() ||  !m_pModel || !m_pView)
+        return;
+
+    UIFileTableItem *item = static_cast<UIFileTableItem*>(index.internalPointer());
+    if (!item)
+        return;
+    /* check if we need to go up: */
+    if (item->isUpDirectory())
+    {
+        QModelIndex parentIndex = m_pModel->parent(m_pModel->parent(index));
+        if (parentIndex.isValid())
+            changeLocation(parentIndex);
+        // else
+        //     changeLocation(m_pModel->rootIndex());
+        return;
+    }
+
+    if (!item->isDirectory())
+        return;
+    if(!item->isOpened())
+       readDirectory(item->path(),item);
+
+    changeLocation(index);
+}
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileTable.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileTable.h	(revision 71179)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileTable.h	(revision 71181)
@@ -21,11 +21,9 @@
 /* Qt includes: */
 #include <QAbstractItemModel>
+#include <QTreeView>
 #include <QWidget>
 
 /* COM includes: */
 #include "COMEnums.h"
-// #include "CEventListener.h"
-// #include "CEventSource.h"
-// #include "CGuest.h"
 #include "CGuestSession.h"
 
@@ -34,9 +32,12 @@
 
 /* Forward declarations: */
+class QILineEdit;
 class QVBoxLayout;
 class UIFileTableItem;
 class UIGuestControlFileTable;
 
-
+/** UIGuestControlFileModel serves as the model for a file structure.
+    it supports a tree level hierarchy which can be displayed with
+    QTableView and/or QTreeView */
 class UIGuestControlFileModel : public QAbstractItemModel
 {
@@ -59,4 +60,5 @@
     int columnCount(const QModelIndex &parent = QModelIndex()) const /* override */;
     void signalUpdate();
+    QModelIndex rootIndex() const;
 
 private:
@@ -65,19 +67,11 @@
     void setupModelData(const QStringList &lines, UIFileTableItem *parent);
     UIGuestControlFileTable* m_pParent;
+    UIFileTableItem *m_pRootItem;
 };
 
-
-class UIGuestControlFileView : public QTableView
-{
-    Q_OBJECT;
-
-public:
-
-    UIGuestControlFileView(QWidget *pParent = 0);
-
-private:
-
-};
-
+/** This serves a base class for file table. Currently a guest version
+    and a host version are derived from this base. Each of these children
+    populates the UIGuestControlFileModel by scanning the file system
+    differently. */
 class UIGuestControlFileTable : public QWidget
 {
@@ -91,7 +85,15 @@
 protected:
 
+    void updateCurrentLocationEdit(const QString& strLocation);
+    void changeLocation(const QModelIndex &index);
     UIFileTableItem         *m_pRootItem;
-    UIGuestControlFileView  *m_pView;
+
+    /** Using QITableView causes the following problem when I click on the table items
+        Qt WARNING: Cannot creat accessible child interface for object:  UIGuestControlFileView.....
+        so for now subclass QTableView */
+    QTableView   *m_pView;
     UIGuestControlFileModel *m_pModel;
+    QTreeView   *m_pTree;
+
 
 private:
@@ -99,8 +101,11 @@
     void                    prepareObjects();
     QVBoxLayout             *m_pMainLayout;
+    QILineEdit              *m_pCurrentLocationEdit;
+
     friend class UIGuestControlFileModel;
 };
 
-
+/** This class scans the guest file system by using the VBox API
+    and populates the UIGuestControlFileModel*/
 class UIGuestFileTable : public UIGuestControlFileTable
 {
@@ -112,4 +117,8 @@
     void initGuestFileTable(const CGuestSession &session);
 
+private slots:
+
+    void sltItemDoubleClicked(const QModelIndex &index);
+
 private:
     void readDirectory(const QString& strPath,
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.cpp	(revision 71179)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.cpp	(revision 71181)
@@ -346,6 +346,4 @@
         if (directory.isOk())
         {
-            //printf("directory opened\n");
-            //CGuestFsObjInfo directoryInfo = static_cast<CGuestFsObjInfo>(directory.Read());
             CFsObjInfo directoryInfo = directory.Read();
             while (directoryInfo.isOk())
