VirtualBox

Changeset 100520 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 11, 2023 4:32:53 PM (21 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
158321
Message:

FE/Qt: bugref:9080. Refactoring viso entry creation.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp

    r100502 r100520  
    312312        pAddedItem->setData(strISOFilePath, UICustomFileSystemModelData_ISOFilePath);
    313313        pAddedItem->setIsOpened(false);
    314         // if (fileInfo.isSymLink())
    315         // {
    316         //     pAddedItem->setTargetPath(fileInfo.symLinkTarget());
    317         //     pAddedItem->setIsSymLinkToADirectory(QFileInfo(fileInfo.symLinkTarget()).isDir());
    318         // }
    319         //createVisoEntry(pAddedItem);
     314
    320315    }
    321316    if (m_pTableProxyModel)
     
    381376            pAddedItem->setIsSymLinkToADirectory(QFileInfo(fileInfo.symLinkTarget()).isDir());
    382377        }
    383         createVisoEntry(pAddedItem);
     378        createVisoEntry(pAddedItem->path(), pAddedItem->data(UICustomFileSystemModelData_LocalPath).toString(), false);
    384379    }
    385380    if (m_pTableProxyModel)
     
    387382}
    388383
    389 void UIVisoContentBrowser::createVisoEntry(UICustomFileSystemItem *pItem, bool bRemove /* = false */)
    390 {
    391     if (!pItem)
    392         return;
    393     if (pItem->path().isEmpty())
    394         return;
    395 
    396 
    397     if (!bRemove && pItem->data(UICustomFileSystemModelData_LocalPath).toString().isEmpty())
    398         return;
     384void UIVisoContentBrowser::createVisoEntry(const QString &strPath, const QString &strLocalPath, bool bRemove /* = false */)
     385{
     386    if (strPath.isEmpty())
     387        return;
     388
    399389    if (!bRemove)
    400         m_entryMap.insert(pItem->path(),
    401                           pItem->data(UICustomFileSystemModelData_LocalPath).toString());
     390    {
     391        if(strLocalPath.isEmpty())
     392            return;
     393        m_entryMap.insert(strPath, strLocalPath);
     394    }
    402395    else
    403         m_entryMap.insert(pItem->path(),
    404                           ":remove:");
     396        m_entryMap.insert(strPath, ":remove:");
    405397}
    406398
     
    525517        }
    526518        if (!bFoundInMap)
    527             createVisoEntry(pItem, true /* bool bRemove */);
     519            createVisoEntry(pItem->path(), pItem->data(UICustomFileSystemModelData_LocalPath).toString(), true /* bool bRemove */);
    528520    }
    529521
     
    872864            if (!pItem)
    873865            {
    874                 pItem = new UICustomFileSystemItem(pathList[i],
    875                                                    pParent,
    876                                                    enmObjectType);
     866                pItem = new UICustomFileSystemItem(pathList[i], pParent, enmObjectType);
    877867                if (!pItem)
    878868                    continue;
     
    882872            }
    883873            if (i == pathList.size() - 1)
    884                 createVisoEntry(pItem);
     874                createVisoEntry(pItem->path(), pItem->data(UICustomFileSystemModelData_LocalPath).toString(), false);
    885875            pParent = pItem;
    886876        }
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.h

    r100502 r100520  
    127127     *  if @p bRemove is true then the value is the string ":remove:" which effectively removes the file object
    128128     *  from the iso image. */
    129     void                    createVisoEntry(UICustomFileSystemItem *pItem, bool bRemove = false);
     129    void                    createVisoEntry(const QString &strPath, const QString &strLocalPath, bool bRemove = false);
    130130    QString                 currentPath() const;
    131131    UICustomFileSystemItem* searchItemByPath(const QString &strPath);
Note: See TracChangeset for help on using the changeset viewer.

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