VirtualBox

Ignore:
Timestamp:
Apr 12, 2018 3:39:09 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699 Teach file manager to list host drive letters

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.cpp

    r71832 r71852  
    10081008    if (m_pRootItem)
    10091009        reset();
    1010     determineDriveLetters();
     1010
    10111011    /* Root item: */
    10121012    const QString startPath("/");
     
    10211021    m_pRootItem->appendChild(startItem);
    10221022    startItem->setIsOpened(false);
     1023    populateStartDirectory(startItem);
     1024    m_pView->setRootIndex(m_pModel->rootIndex());
     1025    m_pModel->signalUpdate();
     1026    updateCurrentLocationEdit(startPath);
     1027}
     1028
     1029void UIGuestControlFileTable::populateStartDirectory(UIFileTableItem *startItem)
     1030{
     1031    determineDriveLetters();
    10231032    if (m_driveLetterList.isEmpty())
    10241033    {
    10251034        /* Read the root directory and get the list: */
    1026         readDirectory(startPath, startItem, true);
     1035        readDirectory(startItem->path(), startItem, true);
    10271036    }
    10281037    else
     
    10411050        }
    10421051    }
    1043     m_pView->setRootIndex(m_pModel->rootIndex());
    1044     m_pModel->signalUpdate();
    1045     updateCurrentLocationEdit(startPath);
     1052
    10461053}
    10471054
     
    11921199    /* For now we clear the whole subtree (that isrecursively) which is an overkill: */
    11931200    treeItem->clearChildren();
    1194     readDirectory(treeItem->path(), treeItem, isRootDir);
     1201    if (isRootDir)
     1202        populateStartDirectory(treeItem);
     1203    else
     1204        readDirectory(treeItem->path(), treeItem, isRootDir);
    11951205    m_pModel->endReset();
    11961206    m_pView->setRootIndex(currentIndex);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.h

    r71832 r71852  
    336336    void            deSelectUpDirectoryItem();
    337337    void            setSelectionForAll(QItemSelectionModel::SelectionFlags flags);
     338    /** Start directory requires a special attention since on file systems with drive letters
     339     *  drive letter are direct children of the start directory. On other systems start directory is '/' */
     340    void            populateStartDirectory(UIFileTableItem *startItem);
    338341    QGridLayout     *m_pMainLayout;
    339342    QComboBox       *m_pLocationComboBox;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIHostFileTable.cpp

    r71832 r71852  
    383383void UIHostFileTable::determineDriveLetters()
    384384{
     385    //#ifdef VBOX_WS_WIN
     386
     387    QFileInfoList drive = QDir::drives();
     388
     389    for (int i = 0; i < drive.size(); ++i)
     390    {
     391        m_driveLetterList.push_back(drive[i].filePath());
     392
     393    }
     394    //#endif
    385395}
    386396
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette