VirtualBox

Changeset 102507 in vbox


Ignore:
Timestamp:
Dec 6, 2023 3:39:31 PM (12 months ago)
Author:
vboxsync
Message:

FE/Qt: ​bugref:9080, bugref:10141. Set VISO content browser's sort case sensitivity wrt. host's file system.

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

Legend:

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

    r102485 r102507  
    7777    bool isGuestSessionRunning() const;
    7878    void setIsCurrent(bool fIsCurrent);
     79    virtual bool  isWindowsFileSystem() const override final;
    7980
    8081protected:
     
    101102    virtual void  setState();
    102103    virtual void  setSessionDependentWidgetsEnabled();
    103     virtual bool  isWindowsFileSystem() const override final;
    104104
    105105private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.h

    r102485 r102507  
    5656    static KFsObjType  fileType(const QFileInfo &fsInfo);
    5757    static KFsObjType  fileType(const QString &strPath);
     58    virtual bool    isWindowsFileSystem() const override final;
    5859
    5960protected:
     
    7677    virtual void    createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) override final;
    7778    virtual void    toggleForwardBackwardActions() override final;
    78     virtual bool    isWindowsFileSystem() const override final;
     79
    7980    /** @name Copy/Cut host-to-host stuff. Currently not implemented.
    8081     * @{ */
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h

    r102485 r102507  
    166166    bool hasSelection() const;
    167167    void setDragDropMode(QAbstractItemView::DragDropMode behavior);
     168    virtual bool     isWindowsFileSystem() const = 0;
    168169
    169170public slots:
     
    227228    virtual void     toggleForwardBackwardActions() = 0;
    228229    virtual bool     event(QEvent *pEvent) RT_OVERRIDE;
    229     virtual bool     isWindowsFileSystem() const = 0;
     230
    230231    /** @name Copy/Cut guest-to-guest (host-to-host) stuff.
    231232     * @{ */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp

    r102498 r102507  
    245245    , m_pTableView(0)
    246246    , m_pModel(0)
    247     , m_pTableProxyModel(0)
     247    , m_pProxyModel(0)
    248248    , m_pMainLayout(0)
    249249    , m_pToolBar(0)
     
    267267    /* Assuming the root items only child is the one with the path '/', navigate into it. */
    268268    /* Hack alert. for some reason without invalidating proxy models mapFromSource return invalid index. */
    269     if (m_pTableProxyModel)
    270         m_pTableProxyModel->invalidate();
     269    if (m_pProxyModel)
     270        m_pProxyModel->invalidate();
    271271
    272272    if (rootItem() && rootItem()->childCount() > 0)
     
    332332
    333333    }
    334     if (m_pTableProxyModel)
    335         m_pTableProxyModel->invalidate();
     334    if (m_pProxyModel)
     335        m_pProxyModel->invalidate();
    336336    pParentItem->setIsOpened(true);
    337337    emit sigISOContentImportedOrRemoved(true /* imported*/);
     
    356356    foreach (UIFileSystemItem *pItem, itemsToDelete)
    357357            m_pModel->deleteItem(pItem);
    358     if (m_pTableProxyModel)
    359         m_pTableProxyModel->invalidate();
     358    if (m_pProxyModel)
     359        m_pProxyModel->invalidate();
    360360
    361361    setImportedISOPath();
     
    369369
    370370    /* Insert items to the current directory shown in the table view: */
    371     QModelIndex parentIndex = m_pTableProxyModel->mapToSource(m_pTableView->rootIndex());
     371    QModelIndex parentIndex = m_pProxyModel->mapToSource(m_pTableView->rootIndex());
    372372    if (!parentIndex.isValid())
    373373         return;
     
    397397        createVisoEntry(pAddedItem->path(), pAddedItem->data(UIFileSystemModelData_LocalPath).toString(), false);
    398398    }
    399     if (m_pTableProxyModel)
    400         m_pTableProxyModel->invalidate();
     399    if (m_pProxyModel)
     400        m_pProxyModel->invalidate();
    401401}
    402402
     
    450450void UIVisoContentBrowser::tableViewItemDoubleClick(const QModelIndex &index)
    451451{
    452     if (!index.isValid() || !m_pTableProxyModel)
     452    if (!index.isValid() || !m_pProxyModel)
    453453        return;
    454454    UIFileSystemItem *pClickedItem =
    455         static_cast<UIFileSystemItem*>(m_pTableProxyModel->mapToSource(index).internalPointer());
     455        static_cast<UIFileSystemItem*>(m_pProxyModel->mapToSource(index).internalPointer());
    456456    if (!pClickedItem)
    457457        return;
     
    487487        strNewDirectoryName = QString("%1_%2").arg(strBaseName).arg(QString::number(iSuffix++));
    488488
    489     QModelIndex parentIndex = m_pTableProxyModel->mapToSource(m_pTableView->rootIndex());
     489    QModelIndex parentIndex = m_pProxyModel->mapToSource(m_pTableView->rootIndex());
    490490    if (!parentIndex.isValid())
    491491         return;
     
    507507
    508508    pAddedItem->setIsOpened(false);
    509     if (m_pTableProxyModel)
    510         m_pTableProxyModel->invalidate();
     509    if (m_pProxyModel)
     510        m_pProxyModel->invalidate();
    511511
    512512    renameFileObject(pAddedItem);
     
    526526{
    527527    AssertReturnVoid(m_pModel);
    528     AssertReturnVoid(m_pTableProxyModel);
     528    AssertReturnVoid(m_pProxyModel);
    529529    foreach(UIFileSystemItem *pItem, itemList)
    530530    {
     
    545545    }
    546546
    547     m_pTableProxyModel->invalidate();
     547    m_pProxyModel->invalidate();
    548548}
    549549
     
    566566        markRemovedUnremovedItemParents(pItem, false);
    567567    }
    568     if (m_pTableProxyModel)
    569         m_pTableProxyModel->invalidate();
     568    if (m_pProxyModel)
     569        m_pProxyModel->invalidate();
    570570}
    571571
     
    611611
    612612    m_pModel = new UIFileSystemModel(this);
    613     m_pTableProxyModel = new UIFileSystemProxyModel(this);
    614     if (m_pTableProxyModel)
    615     {
    616         m_pTableProxyModel->setSourceModel(m_pModel);
    617         m_pTableProxyModel->setListDirectoriesOnTop(true);
     613    m_pProxyModel = new UIFileSystemProxyModel(this);
     614    if (m_pProxyModel)
     615    {
     616        m_pProxyModel->setSourceModel(m_pModel);
     617        m_pProxyModel->setListDirectoriesOnTop(true);
    618618    }
    619619
     
    645645    pHorizontalHeader->setSectionResizeMode(QHeaderView::Stretch);
    646646
    647     m_pTableView->setModel(m_pTableProxyModel);
     647    m_pTableView->setModel(m_pProxyModel);
    648648    setTableRootIndex();
    649649    m_pTableView->hideColumn(UIFileSystemModelData_Owner);
     
    974974    }
    975975
    976     if (m_pTableProxyModel)
    977         m_pTableProxyModel->invalidate();
     976    if (m_pProxyModel)
     977        m_pProxyModel->invalidate();
    978978
    979979}
     
    997997        return QModelIndex();
    998998
    999     if (index.model() == m_pTableProxyModel)
     999    if (index.model() == m_pProxyModel)
    10001000        return index;
    10011001    else if (index.model() == m_pModel)
    1002         return m_pTableProxyModel->mapFromSource(index);
     1002        return m_pProxyModel->mapFromSource(index);
    10031003    return QModelIndex();
    10041004}
     
    10651065    rootItem()->child(0)->setData(strName, UIFileSystemModelData_Name);
    10661066    /* If the table root index is the start item then we have to update the location selector text here: */
    1067     // if (m_pTableProxyModel->mapToSource(m_pTableView->rootIndex()).internalPointer() == rootItem()->child(0))
     1067    // if (m_pProxyModel->mapToSource(m_pTableView->rootIndex()).internalPointer() == rootItem()->child(0))
    10681068    //     updateLocationSelectorText(strName);
    1069     m_pTableProxyModel->invalidate();
     1069    m_pProxyModel->invalidate();
    10701070}
    10711071
    10721072void UIVisoContentBrowser::renameFileObject(UIFileSystemItem *pItem)
    10731073{
    1074     m_pTableView->edit(m_pTableProxyModel->mapFromSource(m_pModel->index(pItem)));
     1074    m_pTableView->edit(m_pProxyModel->mapFromSource(m_pModel->index(pItem)));
    10751075}
    10761076
     
    11151115    }
    11161116
    1117     if (m_pTableProxyModel)
    1118         m_pTableProxyModel->invalidate();
     1117    if (m_pProxyModel)
     1118        m_pProxyModel->invalidate();
    11191119}
    11201120
     
    11341134    rootItem()->child(0)->removeChildren();
    11351135    m_entryMap.clear();
    1136     if (m_pTableProxyModel)
    1137         m_pTableProxyModel->invalidate();
     1136    if (m_pProxyModel)
     1137        m_pProxyModel->invalidate();
    11381138    m_strImportedISOPath.clear();
    11391139}
     
    11891189{
    11901190    QList<UIFileSystemItem*> selectedItems;
    1191     if (!m_pTableProxyModel)
     1191    if (!m_pProxyModel)
    11921192        return selectedItems;
    11931193    QItemSelectionModel *selectionModel = m_pTableView->selectionModel();
     
    11981198    {
    11991199        UIFileSystemItem *pItem =
    1200             static_cast<UIFileSystemItem*>(m_pTableProxyModel->mapToSource(index).internalPointer());
     1200            static_cast<UIFileSystemItem*>(m_pProxyModel->mapToSource(index).internalPointer());
    12011201        if (pItem)
    12021202            selectedItems << pItem;
     
    12091209    if (!m_pTableView || !m_pTableView->rootIndex().isValid())
    12101210        return QString();
    1211     QModelIndex index = m_pTableProxyModel->mapToSource(m_pTableView->rootIndex());
     1211    QModelIndex index = m_pProxyModel->mapToSource(m_pTableView->rootIndex());
    12121212    UIFileSystemItem *pItem = static_cast<UIFileSystemItem*>((index).internalPointer());
    12131213    if (!pItem)
     
    12201220    if (!m_pTableView || !m_pModel)
    12211221        return false;
    1222     QModelIndex index = m_pTableProxyModel->mapToSource(m_pTableView->rootIndex());
     1222    QModelIndex index = m_pProxyModel->mapToSource(m_pTableView->rootIndex());
    12231223    UIFileSystemItem *pItem = static_cast<UIFileSystemItem*>((index).internalPointer());
    12241224    if (!index.isValid() || !pItem)
     
    12311231void UIVisoContentBrowser::goUp()
    12321232{
    1233     AssertReturnVoid(m_pTableProxyModel);
     1233    AssertReturnVoid(m_pProxyModel);
    12341234    AssertReturnVoid(m_pTableView);
    1235     QModelIndex currentRoot = m_pTableProxyModel->mapToSource(m_pTableView->rootIndex());
     1235    QModelIndex currentRoot = m_pProxyModel->mapToSource(m_pTableView->rootIndex());
    12361236    if (!currentRoot.isValid())
    12371237        return;
     
    12511251    if (!m_pTableView || !m_pTableView->rootIndex().isValid())
    12521252        return 0;
    1253     QModelIndex currentRoot = m_pTableProxyModel->mapToSource(m_pTableView->rootIndex());
     1253    QModelIndex currentRoot = m_pProxyModel->mapToSource(m_pTableView->rootIndex());
    12541254
    12551255    return static_cast<UIFileSystemItem*>(currentRoot.internalPointer());
     
    13051305}
    13061306
     1307void UIVisoContentBrowser::setSortCaseSensitive(bool fCaseSensitive)
     1308{
     1309    if (!m_pProxyModel)
     1310        return;
     1311    if (fCaseSensitive)
     1312        m_pProxyModel->setSortCaseSensitivity(Qt::CaseSensitive);
     1313    else
     1314        m_pProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
     1315}
     1316
    13071317#include "UIVisoContentBrowser.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.h

    r102498 r102507  
    8989    bool hasContent() const;
    9090
     91    void setSortCaseSensitive(bool fCaseSensitive);
     92
    9193public slots:
    9294
     
    164166    UIVisoContentTableView *m_pTableView;
    165167    UIFileSystemModel      *m_pModel;
    166     UIFileSystemProxyModel *m_pTableProxyModel;
     168    UIFileSystemProxyModel *m_pProxyModel;
    167169    QPointer<QMenu>        m_pSubMenu;
    168170    QString                m_strImportedISOPath;
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp

    r102474 r102507  
    501501    AssertPtrReturnVoid(m_pVISOContentBrowser);
    502502    pContainerLayout->addWidget(m_pVISOContentBrowser, 0, 5, 1, 4);
     503    /* Set content browsers sort case sensitivity wrt. host's file system: */
     504    m_pVISOContentBrowser->setSortCaseSensitive(!m_pHostFileBrowser->isWindowsFileSystem());
    503505
    504506    m_pSettingsWidget = new UIVisoSettingWidget(this);
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