- Timestamp:
- Jun 23, 2023 3:00:39 PM (18 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.cpp
r100082 r100269 199 199 QString UICustomFileSystemItem::path(bool fRemoveTrailingDelimiters /* = false */) const 200 200 { 201 const QString &strPath = m_itemData.value(UICustomFileSystemModelData_ ISOPath, QString()).toString();201 const QString &strPath = m_itemData.value(UICustomFileSystemModelData_VISOPath, QString()).toString(); 202 202 203 203 if (fRemoveTrailingDelimiters) … … 211 211 if (path.isNull() || path.isEmpty()) 212 212 return; 213 m_itemData[UICustomFileSystemModelData_ ISOPath] = path;213 m_itemData[UICustomFileSystemModelData_VISOPath] = path; 214 214 } 215 215 … … 623 623 m_pRootItem->setData(UICustomFileSystemModel::tr("Permissions"), UICustomFileSystemModelData_Permissions); 624 624 m_pRootItem->setData(UICustomFileSystemModel::tr("Local Path"), UICustomFileSystemModelData_LocalPath); 625 m_pRootItem->setData(UICustomFileSystemModel::tr("Path"), UICustomFileSystemModelData_ ISOPath);626 } 625 m_pRootItem->setData(UICustomFileSystemModel::tr("Path"), UICustomFileSystemModelData_VISOPath); 626 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.h
r100082 r100269 48 48 UICustomFileSystemModelData_Owner, 49 49 UICustomFileSystemModelData_Permissions, 50 UICustomFileSystemModelData_ ISOPath,50 UICustomFileSystemModelData_VISOPath, 51 51 UICustomFileSystemModelData_LocalPath, 52 52 UICustomFileSystemModelData_Max -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp
r100210 r100269 864 864 connect(m_pView, &UIGuestControlFileView::customContextMenuRequested, 865 865 this, &UIFileManagerTable::sltCreateFileViewContextMenu); 866 m_pView->hideColumn(UICustomFileSystemModelData_ ISOPath);866 m_pView->hideColumn(UICustomFileSystemModelData_VISOPath); 867 867 m_pView->hideColumn(UICustomFileSystemModelData_LocalPath); 868 868 m_sessionWidgets << m_pView; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp
r100169 r100269 208 208 } 209 209 210 void UIVisoContentBrowser::addObjectsToViso(QStringList pathList) 210 void UIVisoContentBrowser::importISOContentToViso(const QString &strISOFilePath, const QStringList &pathList, 211 const QList<KFsObjType> &fileObjectTypeList) 212 { 213 //rootItem(); 214 UICustomFileSystemItem *pParentItem = rootItem()->children()[0]; 215 if (!m_pTableView || !pParentItem) 216 return; 217 if (pathList.size() != fileObjectTypeList.size()) 218 return; 219 220 for (int i = 0; i < pathList.size(); ++i) 221 { 222 if (pathList[i] == "." || pathList[i] == "..") 223 continue; 224 225 QFileInfo fileInfo(pathList[i]); 226 if (pParentItem->child(fileInfo.fileName())) 227 continue; 228 printf("%s %s %s\n", qPrintable(fileInfo.fileName()), qPrintable(pathList[i]), qPrintable(pParentItem->data(UICustomFileSystemModelData_VISOPath).toString())); 229 UICustomFileSystemItem* pAddedItem = new UICustomFileSystemItem(fileInfo.fileName(), pParentItem, 230 fileObjectTypeList[i]); 231 pAddedItem->setData(pathList[i], UICustomFileSystemModelData_LocalPath); 232 pAddedItem->setData(UIPathOperations::mergePaths(pParentItem->path(), fileInfo.fileName()), 233 UICustomFileSystemModelData_VISOPath); 234 pAddedItem->setIsOpened(false); 235 // if (fileInfo.isSymLink()) 236 // { 237 // pAddedItem->setTargetPath(fileInfo.symLinkTarget()); 238 // pAddedItem->setIsSymLinkToADirectory(QFileInfo(fileInfo.symLinkTarget()).isDir()); 239 // } 240 createVisoEntry(pAddedItem); 241 } 242 if (m_pTableProxyModel) 243 m_pTableProxyModel->invalidate(); 244 if (m_pTreeProxyModel) 245 { 246 m_pTreeProxyModel->invalidate(); 247 m_pTreeView->setExpanded(m_pTreeView->currentIndex(), true); 248 } 249 } 250 251 252 void UIVisoContentBrowser::addObjectsToViso(const QStringList &pathList) 211 253 { 212 254 if (!m_pTableView) … … 232 274 pAddedItem->setData(strPath, UICustomFileSystemModelData_LocalPath); 233 275 pAddedItem->setData(UIPathOperations::mergePaths(pParentItem->path(), fileInfo.fileName()), 234 UICustomFileSystemModelData_ ISOPath);276 UICustomFileSystemModelData_VISOPath); 235 277 pAddedItem->setIsOpened(false); 236 278 if (fileInfo.isSymLink()) … … 239 281 pAddedItem->setIsSymLinkToADirectory(QFileInfo(fileInfo.symLinkTarget()).isDir()); 240 282 } 241 create AnIsoEntry(pAddedItem);283 createVisoEntry(pAddedItem); 242 284 } 243 285 if (m_pTableProxyModel) … … 250 292 } 251 293 252 void UIVisoContentBrowser::create AnIsoEntry(UICustomFileSystemItem *pItem, bool bRemove /* = false */)294 void UIVisoContentBrowser::createVisoEntry(UICustomFileSystemItem *pItem, bool bRemove /* = false */) 253 295 { 254 296 if (!pItem) 255 297 return; 256 if (pItem->data(UICustomFileSystemModelData_ ISOPath).toString().isEmpty())298 if (pItem->data(UICustomFileSystemModelData_VISOPath).toString().isEmpty()) 257 299 return; 258 300 … … 261 303 return; 262 304 if (!bRemove) 263 m_entryMap.insert(pItem->data(UICustomFileSystemModelData_ ISOPath).toString(),305 m_entryMap.insert(pItem->data(UICustomFileSystemModelData_VISOPath).toString(), 264 306 pItem->data(UICustomFileSystemModelData_LocalPath).toString()); 265 307 else 266 m_entryMap.insert(pItem->data(UICustomFileSystemModelData_ ISOPath).toString(),308 m_entryMap.insert(pItem->data(UICustomFileSystemModelData_VISOPath).toString(), 267 309 ":remove:"); 268 310 } … … 290 332 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Permissions"), UICustomFileSystemModelData_Permissions); 291 333 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Local Path"), UICustomFileSystemModelData_LocalPath); 292 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", " ISO Path"), UICustomFileSystemModelData_ISOPath);334 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "VISO Path"), UICustomFileSystemModelData_VISOPath); 293 335 } 294 336 } … … 342 384 UICustomFileSystemItem* pAddedItem = new UICustomFileSystemItem(strNewDirectoryName, pParentItem, 343 385 KFsObjType_Directory); 344 pAddedItem->setData(UIPathOperations::mergePaths(pParentItem->path(), strNewDirectoryName), UICustomFileSystemModelData_ ISOPath);386 pAddedItem->setData(UIPathOperations::mergePaths(pParentItem->path(), strNewDirectoryName), UICustomFileSystemModelData_VISOPath); 345 387 346 388 pAddedItem->setIsOpened(false); … … 362 404 if (!pItem) 363 405 continue; 364 QString strIsoPath = pItem->data(UICustomFileSystemModelData_ ISOPath).toString();406 QString strIsoPath = pItem->data(UICustomFileSystemModelData_VISOPath).toString(); 365 407 if (strIsoPath.isEmpty()) 366 408 continue; … … 378 420 } 379 421 if (!bFoundInMap) 380 create AnIsoEntry(pItem, true /* bool bRemove */);422 createVisoEntry(pItem, true /* bool bRemove */); 381 423 } 382 424 … … 426 468 m_pTreeView->hideColumn(UICustomFileSystemModelData_Size); 427 469 m_pTreeView->hideColumn(UICustomFileSystemModelData_ChangeTime); 428 m_pTreeView->hideColumn(UICustomFileSystemModelData_ ISOPath);470 m_pTreeView->hideColumn(UICustomFileSystemModelData_VISOPath); 429 471 m_pTreeView->hideColumn(UICustomFileSystemModelData_LocalPath); 430 472 } … … 549 591 if (pItem) 550 592 { 551 QString strPath = pItem->data(UICustomFileSystemModelData_ ISOPath).toString();593 QString strPath = pItem->data(UICustomFileSystemModelData_VISOPath).toString(); 552 594 updateLocationSelectorText(strPath); 553 595 } … … 687 729 688 730 newItem->setData(UIPathOperations::mergePaths(directoryItem->path(), fileInfo.fileName()), 689 UICustomFileSystemModelData_ ISOPath);731 UICustomFileSystemModelData_VISOPath); 690 732 if (fileInfo.isSymLink()) 691 733 { … … 765 807 VISO file for the old path since in some cases, when remaned item is not top level, it still 766 808 appears in ISO. So we remove it explicitly: */ 767 QString oldItemPath = pItem->data(UICustomFileSystemModelData_ ISOPath).toString();809 QString oldItemPath = pItem->data(UICustomFileSystemModelData_VISOPath).toString(); 768 810 m_entryMap.insert(strNewPath, pItem->data(UICustomFileSystemModelData_LocalPath).toString()); 769 811 m_entryMap.remove(oldItemPath); … … 772 814 } 773 815 774 pItem->setData(strNewPath, UICustomFileSystemModelData_ ISOPath);816 pItem->setData(strNewPath, UICustomFileSystemModelData_VISOPath); 775 817 776 818 if (m_pTableProxyModel) -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.h
r100155 r100269 62 62 UIVisoContentBrowser(QWidget *pParent = 0); 63 63 ~UIVisoContentBrowser(); 64 /* Imports pathList (relative to ISO file's root) to VISO content. */ 65 void importISOContentToViso(const QString &strISOFilePath, const QStringList &pathList, 66 const QList<KFsObjType> &fileObjectTypeList); 64 67 /** Adds file objests from the host file system. @p pathList consists of list of paths to there objects. */ 65 void addObjectsToViso( QStringListpathList);68 void addObjectsToViso(const QStringList &pathList); 66 69 /** Returns the content of the VISO as a string list. Each element of the list becomes a line in the 67 70 * .viso file. */ … … 120 123 void renameFileObject(UICustomFileSystemItem *pItem); 121 124 void removeItems(const QList<UICustomFileSystemItem*> itemList); 122 /** Creates and entry for pItem consisting of a map item (key is iso path and value is host file system path)125 /** Creates and entry for pItem consisting of a map item (key is viso path and value is host file system path) 123 126 * if @p bRemove is true then the value is the string ":remove:" which effectively removes the file object 124 127 * from the iso image. */ 125 void create AnIsoEntry(UICustomFileSystemItem *pItem, bool bRemove = false);128 void createVisoEntry(UICustomFileSystemItem *pItem, bool bRemove = false); 126 129 void reset(); 127 130 /** Returns a list of items which are currecntly selected -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r100180 r100269 62 62 #include <iprt/getopt.h> 63 63 #include <iprt/path.h> 64 64 #include <iprt/vfs.h> 65 #include <iprt/file.h> 66 #include <iprt/fsvfs.h> 65 67 66 68 /********************************************************************************************************************************* … … 443 445 if (!m_pHostBrowser) 444 446 return; 445 // QStringList selectedObjectPaths = m_pHostBrowser->selectedPathList(); 446 // printf("dddd %d\n", findISOFiles(selectedObjectPaths).size()); 447 QStringList selectedObjectPaths = m_pHostBrowser->selectedPathList(); 448 if (selectedObjectPaths.isEmpty()) 449 return; 450 QList<KFsObjType> fileObjectTypeList; 451 QStringList pathList; 452 453 int iIndex = 0; 454 455 RTVFSFILE hVfsFileIso; 456 int vrc = RTVfsFileOpenNormal(selectedObjectPaths[iIndex].toUtf8().constData(), RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, &hVfsFileIso); 457 if (RT_SUCCESS(vrc)) 458 { 459 RTERRINFOSTATIC ErrInfo; 460 RTVFS hVfsIso; 461 vrc = RTFsIso9660VolOpen(hVfsFileIso, 0 /*fFlags*/, &hVfsIso, RTErrInfoInitStatic(&ErrInfo)); 462 if (RT_SUCCESS(vrc)) 463 { 464 RTVFSDIR hVfsSrcRootDir; 465 vrc = RTVfsOpenRoot(hVfsIso, &hVfsSrcRootDir); 466 if (RT_SUCCESS(vrc)) 467 { 468 size_t cbDirEntry = sizeof(RTDIRENTRYEX); 469 PRTDIRENTRYEX pDirEntry = (PRTDIRENTRYEX)RTMemTmpAlloc(cbDirEntry); 470 size_t cbDirEntryAlloced = cbDirEntry; 471 for(;;) 472 { 473 if (pDirEntry) 474 { 475 vrc = RTVfsDirReadEx(hVfsSrcRootDir, pDirEntry, &cbDirEntry, RTFSOBJATTRADD_UNIX); 476 if (RT_FAILURE(vrc)) 477 { 478 if (vrc == VERR_BUFFER_OVERFLOW) 479 { 480 RTMemTmpFree(pDirEntry); 481 cbDirEntryAlloced = RT_ALIGN_Z(RT_MIN(cbDirEntry, cbDirEntryAlloced) + 64, 64); 482 pDirEntry = (PRTDIRENTRYEX)RTMemTmpAlloc(cbDirEntryAlloced); 483 if (pDirEntry) 484 continue; 485 /// @todo log error 486 //rcExit = RTMsgErrorExitFailure("Out of memory (direntry buffer)"); 487 } 488 /// @todo log error 489 // else if (rc != VERR_NO_MORE_FILES) 490 // rcExit = RTMsgErrorExitFailure("RTVfsDirReadEx failed: %Rrc\n", rc); 491 break; 492 } 493 else 494 { 495 if (RTFS_IS_DIRECTORY(pDirEntry->Info.Attr.fMode)) 496 fileObjectTypeList << KFsObjType_Directory; 497 else 498 fileObjectTypeList << KFsObjType_File; 499 pathList << pDirEntry->szName; 500 } 501 } 502 } 503 RTMemTmpFree(pDirEntry); 504 } 505 RTVfsRelease(hVfsIso); 506 } 507 RTVfsFileRelease(hVfsFileIso); 508 } 509 if (!pathList.isEmpty() && pathList.size() == fileObjectTypeList.size() && m_pVISOContentBrowser) 510 m_pVISOContentBrowser->importISOContentToViso(selectedObjectPaths[iIndex], pathList, fileObjectTypeList); 511 // return setErrorBoth(E_NOTIMPL, vrc, tr("Failed to open '%s' (%Rrc)"), mStrIsoPath.c_str(), vrc); 512 447 513 } 448 514
Note:
See TracChangeset
for help on using the changeset viewer.