VirtualBox

Changeset 100418 in vbox


Ignore:
Timestamp:
Jul 6, 2023 5:26:08 PM (17 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9080. bugref:6699. Update tree item's children map after a rename.

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

Legend:

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

    r100410 r100418  
    7777}
    7878
     79void UICustomFileSystemItem::childRenamed()
     80{
     81    /* Recreate child map to accomadate the new file object name of the children: */
     82    m_childMap.clear();
     83    foreach(UICustomFileSystemItem* pItem, m_childItems)
     84        m_childMap[pItem->fileObjectName()] = pItem;
     85}
     86
    7987void UICustomFileSystemItem::reset()
    8088{
     
    150158void UICustomFileSystemItem::setData(const QVariant &data, int index)
    151159{
     160    if (m_itemData[static_cast<UICustomFileSystemModelData>(index)] == data)
     161        return;
    152162    m_itemData[static_cast<UICustomFileSystemModelData>(index)] = data;
     163    if (static_cast<UICustomFileSystemModelData>(index) == UICustomFileSystemModelData_Name && parentItem())
     164        parentItem()->childRenamed();
    153165}
    154166
     
    220232
    221233    return UIPathOperations::removeMultipleDelimiters(path.join("/"));
    222 }
    223 
    224 void UICustomFileSystemItem::setPath(const QString &path)
    225 {
    226     if (path.isNull() || path.isEmpty())
    227         return;
    228     m_itemData[UICustomFileSystemModelData_VISOPath] = path;
    229234}
    230235
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.h

    r100410 r100418  
    9090    /** Full absolute path of the item. With or without the trailing '/' */
    9191    QString  path(bool fRemoveTrailingDelimiters = false) const;
    92     void setPath(const QString &path);
    9392
    9493    /** Returns true if this is directory and file object name is ".." */
     
    118117
    119118private:
     119
    120120    void appendChild(UICustomFileSystemItem *child);
    121 
     121    void childRenamed();
    122122    QList<UICustomFileSystemItem*>         m_childItems;
    123123    /** Used to find children by file object name */
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp

    r100410 r100418  
    569569                    item->setData(fsInfo.GetUserName(), UICustomFileSystemModelData_Owner);
    570570                    item->setData(permissionString(fsInfo), UICustomFileSystemModelData_Permissions);
    571                     item->setPath(UIPathOperations::removeTrailingDelimiters(UIPathOperations::mergePaths(strPath, fsInfo.GetName())));
    572571                    item->setIsOpened(false);
    573572                    item->setIsHidden(isFileObjectHidden(fsInfo));
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.cpp

    r100410 r100418  
    166166        item->setData(fileInfo.owner(),        UICustomFileSystemModelData_Owner);
    167167        item->setData(permissionString(fileInfo.permissions()),  UICustomFileSystemModelData_Permissions);
    168         item->setPath(fileInfo.absoluteFilePath());
     168
    169169        /* if the item is a symlink set the target path and
    170170           check the target if it is a directory: */
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp

    r100410 r100418  
    520520{
    521521    if (m_pNavigationWidget)
    522     {
    523522        m_pNavigationWidget->setPath(strLocation);
    524     }
    525523}
    526524
     
    553551    const QString startPath("/");
    554552    UICustomFileSystemItem* startItem = new UICustomFileSystemItem(startPath, rootItem(), KFsObjType_Directory);
    555     startItem->setPath(startPath);
     553
    556554    startItem->setIsOpened(false);
    557555    populateStartDirectory(startItem);
     
    576574            UICustomFileSystemItem* driveItem = new UICustomFileSystemItem(UIPathOperations::removeTrailingDelimiters(m_driveLetterList[i]),
    577575                                                                           startItem, KFsObjType_Directory);
    578             driveItem->setPath(m_driveLetterList[i]);
    579576            driveItem->setIsOpened(false);
    580577            driveItem->setIsDriveItem(true);
     
    702699        /* search the current path item among the parent's children: */
    703700        UICustomFileSystemItem *item = parent->child(pathTrail.at(i));
     701
    704702        if (!item)
    705703            return;
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp

    r100410 r100418  
    718718
    719719    UICustomFileSystemItem *pStartItem = new UICustomFileSystemItem(startPath, rootItem(), KFsObjType_Directory);
    720     pStartItem->setPath("/");
     720
    721721    pStartItem->setIsOpened(false);
    722722}
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