VirtualBox

Changeset 76300 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 19, 2018 7:17:55 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699. Get rid of the FileObjectType enum and use KFsObjType

Location:
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl
Files:
6 edited

Legend:

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

    r76210 r76300  
    205205                 << changeTime << fsInfo.GetUserName() << permissionString(fsInfo);
    206206
    207             FileObjectType fsObjectType = fileType(fsInfo);
     207            KFsObjType fsObjectType = fileType(fsInfo);
    208208            UIFileTableItem *item = new UIFileTableItem(data, parent, fsObjectType);
    209209
     
    211211                continue;
    212212            item->setPath(UIPathOperations::mergePaths(strPath, fsInfo.GetName()));
    213             if (fsObjectType == FileObjectType_Directory)
     213            if (fsObjectType == KFsObjType_Directory)
    214214            {
    215215                directories.insert(fsInfo.GetName(), item);
    216216                item->setIsOpened(false);
    217217            }
    218             else if(fsObjectType == FileObjectType_File)
     218            else if(fsObjectType == KFsObjType_File)
    219219            {
    220220                files.insert(fsInfo.GetName(), item);
    221221                item->setIsOpened(false);
    222222            }
    223             else if(fsObjectType == FileObjectType_SymLink)
     223            else if(fsObjectType == KFsObjType_Symlink)
    224224            {
    225225                files.insert(fsInfo.GetName(), item);
     
    267267    {
    268268        CGuestFsObjInfo fileInfo = m_comGuestSession.FsObjQueryInfo(strPath, true);
    269         FileObjectType eType = fileType(fileInfo);
    270         if (eType == FileObjectType_File || eType == FileObjectType_SymLink)
     269        KFsObjType eType = fileType(fileInfo);
     270        if (eType == KFsObjType_File || eType == KFsObjType_Symlink)
    271271        {
    272272              m_comGuestSession.FsObjRemove(strPath);
    273273        }
    274         else if (eType == FileObjectType_Directory)
     274        else if (eType == KFsObjType_Directory)
    275275        {
    276276            QVector<KDirectoryRemoveRecFlag> flags(KDirectoryRemoveRecFlag_ContentAndDir);
     
    391391}
    392392
    393 FileObjectType UIFileManagerGuestTable::fileType(const CFsObjInfo &fsInfo)
     393KFsObjType UIFileManagerGuestTable::fileType(const CFsObjInfo &fsInfo)
    394394{
    395395    if (fsInfo.isNull() || !fsInfo.isOk())
    396         return FileObjectType_Unknown;
     396        return KFsObjType_Unknown;
    397397    if (fsInfo.GetType() == KFsObjType_Directory)
    398          return FileObjectType_Directory;
     398         return KFsObjType_Directory;
    399399    else if (fsInfo.GetType() == KFsObjType_File)
    400         return FileObjectType_File;
     400        return KFsObjType_File;
    401401    else if (fsInfo.GetType() == KFsObjType_Symlink)
    402         return FileObjectType_SymLink;
    403 
    404     return FileObjectType_Other;
    405 }
    406 
    407 FileObjectType UIFileManagerGuestTable::fileType(const CGuestFsObjInfo &fsInfo)
     402        return KFsObjType_Symlink;
     403
     404    return KFsObjType_Unknown;
     405}
     406
     407KFsObjType UIFileManagerGuestTable::fileType(const CGuestFsObjInfo &fsInfo)
    408408{
    409409    if (fsInfo.isNull() || !fsInfo.isOk())
    410         return FileObjectType_Unknown;
     410        return KFsObjType_Unknown;
    411411    if (fsInfo.GetType() == KFsObjType_Directory)
    412          return FileObjectType_Directory;
     412         return KFsObjType_Directory;
    413413    else if (fsInfo.GetType() == KFsObjType_File)
    414         return FileObjectType_File;
     414        return KFsObjType_File;
    415415    else if (fsInfo.GetType() == KFsObjType_Symlink)
    416         return FileObjectType_SymLink;
    417 
    418     return FileObjectType_Other;
     416        return KFsObjType_Symlink;
     417
     418    return KFsObjType_Unknown;
    419419}
    420420
     
    530530        }
    531531
    532         FileObjectType type = fileType(fileInfo);
    533 
    534         if (type == FileObjectType_File)
     532        KFsObjType type = fileType(fileInfo);
     533
     534        if (type == KFsObjType_File)
    535535            ++fileCount;
    536         if (type == FileObjectType_Directory)
     536        if (type == KFsObjType_Directory)
    537537            ++directoryCount;
    538538        totalSize += fileInfo.GetObjectSize();
     
    569569    // bool createWorkerThread = (selectedObjects.size() > 1);
    570570    // if (!createWorkerThread &&
    571     //     fileType(m_comGuestSession.FsObjQueryInfo(selectedObjects[0], true)) == FileObjectType_Directory)
     571    //     fileType(m_comGuestSession.FsObjQueryInfo(selectedObjects[0], true)) == KFsObjType_Directory)
    572572    //     createWorkerThread = true;
    573573    // if (createWorkerThread)
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.h

    r76177 r76300  
    7373private:
    7474
    75     FileObjectType  fileType(const CFsObjInfo &fsInfo);
    76     FileObjectType  fileType(const CGuestFsObjInfo &fsInfo);
     75    KFsObjType  fileType(const CFsObjInfo &fsInfo);
     76    KFsObjType  fileType(const CGuestFsObjInfo &fsInfo);
    7777
    7878    void prepareActionConnections();
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.cpp

    r76297 r76300  
    276276    {
    277277        bool deleteSuccess = true;
    278         FileObjectType eType = fileType(QFileInfo(strPath));
    279         if (eType == FileObjectType_File || eType == FileObjectType_SymLink)
     278        KFsObjType eType = fileType(QFileInfo(strPath));
     279        if (eType == KFsObjType_File || eType == KFsObjType_Symlink)
    280280        {
    281281            deleteSuccess = QDir().remove(strPath);
    282282        }
    283         else if (eType == FileObjectType_Directory)
     283        else if (eType == KFsObjType_Directory)
    284284        {
    285285            QDir itemToDelete(strPath);
     
    330330}
    331331
    332 FileObjectType UIFileManagerHostTable::fileType(const QFileInfo &fsInfo)
     332KFsObjType UIFileManagerHostTable::fileType(const QFileInfo &fsInfo)
    333333{
    334334    if (!fsInfo.exists())
    335         return FileObjectType_Unknown;
     335        return KFsObjType_Unknown;
    336336    /* first check if it is symlink becacuse for Qt
    337337       being smylin and directory/file is not mutually exclusive: */
    338338    if (fsInfo.isSymLink())
    339         return FileObjectType_SymLink;
     339        return KFsObjType_Symlink;
    340340    else if (fsInfo.isFile())
    341         return FileObjectType_File;
     341        return KFsObjType_File;
    342342    else if (fsInfo.isDir())
    343         return FileObjectType_Directory;
    344 
    345     return FileObjectType_Other;
     343        return KFsObjType_Directory;
     344
     345    return KFsObjType_Unknown;
    346346}
    347347
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.h

    r76297 r76300  
    3737protected:
    3838
    39     FileObjectType  fileType(const QFileInfo &fsInfo);
     39    KFsObjType  fileType(const QFileInfo &fsInfo);
    4040    void            retranslateUi() /* override */;
    4141    virtual void    readDirectory(const QString& strPath, UIFileTableItem *parent, bool isStartDir = false) /* override */;
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp

    r76297 r76300  
    460460
    461461UIFileTableItem::UIFileTableItem(const QVector<QVariant> &data,
    462                                  UIFileTableItem *parent, FileObjectType type)
     462                                 UIFileTableItem *parent, KFsObjType type)
    463463    : m_itemData(data)
    464464    , m_parentItem(parent)
     
    539539bool UIFileTableItem::isDirectory() const
    540540{
    541     return m_type == FileObjectType_Directory;
     541    return m_type == KFsObjType_Directory;
    542542}
    543543
    544544bool UIFileTableItem::isSymLink() const
    545545{
    546     return m_type == FileObjectType_SymLink;
     546    return m_type == KFsObjType_Symlink;
    547547}
    548548
    549549bool UIFileTableItem::isFile() const
    550550{
    551     return m_type == FileObjectType_File;
     551    return m_type == KFsObjType_File;
    552552}
    553553
     
    591591}
    592592
    593 FileObjectType UIFileTableItem::type() const
     593KFsObjType UIFileTableItem::type() const
    594594{
    595595    return m_type;
     
    864864    QVector<QVariant> headData;
    865865    headData.resize(UICustomFileSystemModelColumn_Max);
    866     m_pRootItem = new UIFileTableItem(headData, 0, FileObjectType_Directory);
     866    m_pRootItem = new UIFileTableItem(headData, 0, KFsObjType_Directory);
    867867    UIFileTableItem* startItem = new UIFileTableItem(createTreeItemData(startPath, 4096, QDateTime(),
    868868                                                                        "" /* owner */, "" /* permissions */),
    869                                                      m_pRootItem, FileObjectType_Directory);
     869                                                     m_pRootItem, KFsObjType_Directory);
    870870    startItem->setPath(startPath);
    871871    m_pRootItem->appendChild(startItem);
     
    892892            UIFileTableItem* driveItem = new UIFileTableItem(createTreeItemData(m_driveLetterList[i], 4096,
    893893                                                                                QDateTime(), QString(), QString()),
    894                                                              startItem, FileObjectType_Directory);
     894                                                             startItem, KFsObjType_Directory);
    895895            driveItem->setPath(m_driveLetterList[i]);
    896896            startItem->appendChild(driveItem);
     
    915915            UIFileTableItem *item = new UIFileTableItem(createTreeItemData(UICustomFileSystemModel::strUpDirectoryString, 4096,
    916916                                                                           QDateTime(), QString(), QString())
    917                                                         , parent, FileObjectType_Directory);
     917                                                        , parent, KFsObjType_Directory);
    918918            item->setIsOpened(false);
    919919            map.insert(UICustomFileSystemModel::strUpDirectoryString, item);
     
    14521452}
    14531453
    1454 QString UIFileManagerTable::fileTypeString(FileObjectType type)
     1454QString UIFileManagerTable::fileTypeString(KFsObjType type)
    14551455{
    14561456    QString strType = UIFileManager::tr("Unknown");
    14571457    switch (type)
    14581458    {
    1459         case FileObjectType_File:
     1459        case KFsObjType_File:
    14601460            strType = UIFileManager::tr("File");
    14611461            break;
    1462         case FileObjectType_Directory:
     1462        case KFsObjType_Directory:
    14631463            strType = UIFileManager::tr("Directory");
    14641464            break;
    1465         case FileObjectType_SymLink:
     1465        case KFsObjType_Symlink:
    14661466            strType = UIFileManager::tr("Symbolic Link");
    14671467            break;
    1468         case FileObjectType_Other:
    1469             strType = UIFileManager::tr("Other");
    1470             break;
    1471 
    1472         case FileObjectType_Unknown:
     1468        case KFsObjType_Unknown:
    14731469        default:
     1470            strType = UIFileManager::tr("Unknown");
    14741471            break;
    14751472    }
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h

    r76297 r76300  
    5252class UIToolBar;
    5353
    54 /** @todo r=bird: Why don't you just use KFsObjType? */
    55 enum FileObjectType
    56 {
    57     FileObjectType_File = 0,
    58     FileObjectType_Directory,
    59     FileObjectType_SymLink,
    60     FileObjectType_Other,
    61     FileObjectType_Unknown,
    62     FileObjectType_Max
    63 };
    64 
    6554/** A simple struck to store some statictics for a directory. Mainly used by  UIDirectoryDiskUsageComputer instances. */
    6655class UIDirectoryStatistics
     
    170159     *  directory */
    171160    explicit UIFileTableItem(const QVector<QVariant> &data,
    172                              UIFileTableItem *parentItem, FileObjectType type);
     161                             UIFileTableItem *parentItem, KFsObjType type);
    173162    ~UIFileTableItem();
    174163
     
    199188    void clearChildren();
    200189
    201     FileObjectType   type() const;
     190    KFsObjType  type() const;
    202191
    203192    const QString &targetPath() const;
     
    232221    /** True if this is a symlink and the target is a directory */
    233222    bool             m_isTargetADirectory;
    234     FileObjectType   m_type;
     223    KFsObjType  m_type;
    235224    /** True if only this item represents a DOS style drive letter item */
    236225    bool             m_isDriveItem;
     
    331320    /** @} */
    332321
    333     QString          fileTypeString(FileObjectType type);
     322    QString          fileTypeString(KFsObjType type);
    334323    /* @p item index is item location in model not in 'proxy' model */
    335324    void             goIntoDirectory(const QModelIndex &itemIndex);
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