VirtualBox

Ignore:
Timestamp:
Jan 3, 2019 2:40:48 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: 6699: Manage tree item path correctly

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.cpp

    r76606 r76621  
    162162}
    163163
    164 const QString  &UICustomFileSystemItem::path() const
    165 {
    166     return m_strPath;
     164QString  UICustomFileSystemItem::path() const
     165{
     166    return m_itemData.value(UICustomFileSystemModelColumn_Path, QString()).toString();
    167167}
    168168
    169169void UICustomFileSystemItem::setPath(const QString &path)
    170170{
    171     if (path.isNull() || path.isEmpty())
     171    QString strNewPath =     UIPathOperations::removeTrailingDelimiters(path);
     172    if (strNewPath.isNull() || strNewPath.isEmpty())
    172173        return;
    173     m_strPath = path;
    174     UIPathOperations::removeTrailingDelimiters(m_strPath);
     174    m_itemData[UICustomFileSystemModelColumn_Path] = strNewPath;
    175175}
    176176
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.h

    r76581 r76621  
    2626#include <QSortFilterProxyModel>
    2727
     28#include "UILibraryDefs.h"
     29
    2830/* COM includes: */
    2931#include "COMEnums.h"
     
    4345/** A UICustomFileSystemItem instance is a tree node representing a file object (file, directory, etc). The tree contructed
    4446    by these instances is the data source for the UICustomFileSystemModel. */
    45 class UICustomFileSystemItem
     47class SHARED_LIBRARY_STUFF UICustomFileSystemItem
    4648{
    4749public:
     
    7072    void setIsOpened(bool flag);
    7173
    72     const QString  &path() const;
     74    /** Full absolute path of the item. Without the trailing '/' */
     75    QString  path() const;
    7376    void setPath(const QString &path);
    7477
     
    104107    UICustomFileSystemItem *m_parentItem;
    105108    bool             m_bIsOpened;
    106     /** Full absolute path of the item. Without the trailing '/' */
    107     QString          m_strPath;
    108109    /** If this is a symlink m_targetPath keeps the absolute path of the target */
    109110    QString          m_strTargetPath;
     
    117118/** A QSortFilterProxyModel extension used in file tables. Modifies some
    118119 *  of the base class behavior like lessThan(..) */
    119 class UICustomFileSystemProxyModel : public QSortFilterProxyModel
     120class SHARED_LIBRARY_STUFF UICustomFileSystemProxyModel : public QSortFilterProxyModel
    120121{
    121122
     
    140141 *  it supports a tree level hierarchy which can be displayed with
    141142 *  QTableView and/or QTreeView.*/
    142 class UICustomFileSystemModel : public QAbstractItemModel
     143class SHARED_LIBRARY_STUFF UICustomFileSystemModel : public QAbstractItemModel
    143144{
    144145
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPathOperations.h

    r76581 r76621  
    2525#include <QString>
    2626
     27/* GUI includes: */
     28#include "UILibraryDefs.h"
    2729
    2830/** A collection of simple utility functions to manipulate path strings */
    29 class UIPathOperations
     31class SHARED_LIBRARY_STUFF UIPathOperations
    3032{
    3133public:
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.cpp

    r76606 r76621  
    141141    if (!directory.exists())
    142142        return;
    143     QFileInfoList entries = directory.entryInfoList();
     143    QFileInfoList entries = directory.entryInfoList(QDir::Hidden|QDir::AllEntries|QDir::NoDotAndDotDot);
    144144    for (int i = 0; i < entries.size(); ++i)
    145145    {
    146146        const QFileInfo &fileInfo = entries.at(i);
    147 
    148         if (fileInfo.fileName() == ".")
    149             continue;
    150         if (fileInfo.fileName() == "..")
    151             continue;
    152147
    153148        UICustomFileSystemItem *item = new UICustomFileSystemItem(fileInfo.fileName(), parent, fileType(fileInfo));
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