Changeset 76300 in vbox for trunk/src/VBox
- Timestamp:
- Dec 19, 2018 7:17:55 PM (6 years ago)
- 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 205 205 << changeTime << fsInfo.GetUserName() << permissionString(fsInfo); 206 206 207 FileObjectType fsObjectType = fileType(fsInfo);207 KFsObjType fsObjectType = fileType(fsInfo); 208 208 UIFileTableItem *item = new UIFileTableItem(data, parent, fsObjectType); 209 209 … … 211 211 continue; 212 212 item->setPath(UIPathOperations::mergePaths(strPath, fsInfo.GetName())); 213 if (fsObjectType == FileObjectType_Directory)213 if (fsObjectType == KFsObjType_Directory) 214 214 { 215 215 directories.insert(fsInfo.GetName(), item); 216 216 item->setIsOpened(false); 217 217 } 218 else if(fsObjectType == FileObjectType_File)218 else if(fsObjectType == KFsObjType_File) 219 219 { 220 220 files.insert(fsInfo.GetName(), item); 221 221 item->setIsOpened(false); 222 222 } 223 else if(fsObjectType == FileObjectType_SymLink)223 else if(fsObjectType == KFsObjType_Symlink) 224 224 { 225 225 files.insert(fsInfo.GetName(), item); … … 267 267 { 268 268 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) 271 271 { 272 272 m_comGuestSession.FsObjRemove(strPath); 273 273 } 274 else if (eType == FileObjectType_Directory)274 else if (eType == KFsObjType_Directory) 275 275 { 276 276 QVector<KDirectoryRemoveRecFlag> flags(KDirectoryRemoveRecFlag_ContentAndDir); … … 391 391 } 392 392 393 FileObjectType UIFileManagerGuestTable::fileType(const CFsObjInfo &fsInfo)393 KFsObjType UIFileManagerGuestTable::fileType(const CFsObjInfo &fsInfo) 394 394 { 395 395 if (fsInfo.isNull() || !fsInfo.isOk()) 396 return FileObjectType_Unknown;396 return KFsObjType_Unknown; 397 397 if (fsInfo.GetType() == KFsObjType_Directory) 398 return FileObjectType_Directory;398 return KFsObjType_Directory; 399 399 else if (fsInfo.GetType() == KFsObjType_File) 400 return FileObjectType_File;400 return KFsObjType_File; 401 401 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 407 KFsObjType UIFileManagerGuestTable::fileType(const CGuestFsObjInfo &fsInfo) 408 408 { 409 409 if (fsInfo.isNull() || !fsInfo.isOk()) 410 return FileObjectType_Unknown;410 return KFsObjType_Unknown; 411 411 if (fsInfo.GetType() == KFsObjType_Directory) 412 return FileObjectType_Directory;412 return KFsObjType_Directory; 413 413 else if (fsInfo.GetType() == KFsObjType_File) 414 return FileObjectType_File;414 return KFsObjType_File; 415 415 else if (fsInfo.GetType() == KFsObjType_Symlink) 416 return FileObjectType_SymLink;417 418 return FileObjectType_Other;416 return KFsObjType_Symlink; 417 418 return KFsObjType_Unknown; 419 419 } 420 420 … … 530 530 } 531 531 532 FileObjectType type = fileType(fileInfo);533 534 if (type == FileObjectType_File)532 KFsObjType type = fileType(fileInfo); 533 534 if (type == KFsObjType_File) 535 535 ++fileCount; 536 if (type == FileObjectType_Directory)536 if (type == KFsObjType_Directory) 537 537 ++directoryCount; 538 538 totalSize += fileInfo.GetObjectSize(); … … 569 569 // bool createWorkerThread = (selectedObjects.size() > 1); 570 570 // if (!createWorkerThread && 571 // fileType(m_comGuestSession.FsObjQueryInfo(selectedObjects[0], true)) == FileObjectType_Directory)571 // fileType(m_comGuestSession.FsObjQueryInfo(selectedObjects[0], true)) == KFsObjType_Directory) 572 572 // createWorkerThread = true; 573 573 // if (createWorkerThread) -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.h
r76177 r76300 73 73 private: 74 74 75 FileObjectType fileType(const CFsObjInfo &fsInfo);76 FileObjectType fileType(const CGuestFsObjInfo &fsInfo);75 KFsObjType fileType(const CFsObjInfo &fsInfo); 76 KFsObjType fileType(const CGuestFsObjInfo &fsInfo); 77 77 78 78 void prepareActionConnections(); -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.cpp
r76297 r76300 276 276 { 277 277 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) 280 280 { 281 281 deleteSuccess = QDir().remove(strPath); 282 282 } 283 else if (eType == FileObjectType_Directory)283 else if (eType == KFsObjType_Directory) 284 284 { 285 285 QDir itemToDelete(strPath); … … 330 330 } 331 331 332 FileObjectType UIFileManagerHostTable::fileType(const QFileInfo &fsInfo)332 KFsObjType UIFileManagerHostTable::fileType(const QFileInfo &fsInfo) 333 333 { 334 334 if (!fsInfo.exists()) 335 return FileObjectType_Unknown;335 return KFsObjType_Unknown; 336 336 /* first check if it is symlink becacuse for Qt 337 337 being smylin and directory/file is not mutually exclusive: */ 338 338 if (fsInfo.isSymLink()) 339 return FileObjectType_SymLink;339 return KFsObjType_Symlink; 340 340 else if (fsInfo.isFile()) 341 return FileObjectType_File;341 return KFsObjType_File; 342 342 else if (fsInfo.isDir()) 343 return FileObjectType_Directory;344 345 return FileObjectType_Other;343 return KFsObjType_Directory; 344 345 return KFsObjType_Unknown; 346 346 } 347 347 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.h
r76297 r76300 37 37 protected: 38 38 39 FileObjectType fileType(const QFileInfo &fsInfo);39 KFsObjType fileType(const QFileInfo &fsInfo); 40 40 void retranslateUi() /* override */; 41 41 virtual void readDirectory(const QString& strPath, UIFileTableItem *parent, bool isStartDir = false) /* override */; -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp
r76297 r76300 460 460 461 461 UIFileTableItem::UIFileTableItem(const QVector<QVariant> &data, 462 UIFileTableItem *parent, FileObjectType type)462 UIFileTableItem *parent, KFsObjType type) 463 463 : m_itemData(data) 464 464 , m_parentItem(parent) … … 539 539 bool UIFileTableItem::isDirectory() const 540 540 { 541 return m_type == FileObjectType_Directory;541 return m_type == KFsObjType_Directory; 542 542 } 543 543 544 544 bool UIFileTableItem::isSymLink() const 545 545 { 546 return m_type == FileObjectType_SymLink;546 return m_type == KFsObjType_Symlink; 547 547 } 548 548 549 549 bool UIFileTableItem::isFile() const 550 550 { 551 return m_type == FileObjectType_File;551 return m_type == KFsObjType_File; 552 552 } 553 553 … … 591 591 } 592 592 593 FileObjectType UIFileTableItem::type() const593 KFsObjType UIFileTableItem::type() const 594 594 { 595 595 return m_type; … … 864 864 QVector<QVariant> headData; 865 865 headData.resize(UICustomFileSystemModelColumn_Max); 866 m_pRootItem = new UIFileTableItem(headData, 0, FileObjectType_Directory);866 m_pRootItem = new UIFileTableItem(headData, 0, KFsObjType_Directory); 867 867 UIFileTableItem* startItem = new UIFileTableItem(createTreeItemData(startPath, 4096, QDateTime(), 868 868 "" /* owner */, "" /* permissions */), 869 m_pRootItem, FileObjectType_Directory);869 m_pRootItem, KFsObjType_Directory); 870 870 startItem->setPath(startPath); 871 871 m_pRootItem->appendChild(startItem); … … 892 892 UIFileTableItem* driveItem = new UIFileTableItem(createTreeItemData(m_driveLetterList[i], 4096, 893 893 QDateTime(), QString(), QString()), 894 startItem, FileObjectType_Directory);894 startItem, KFsObjType_Directory); 895 895 driveItem->setPath(m_driveLetterList[i]); 896 896 startItem->appendChild(driveItem); … … 915 915 UIFileTableItem *item = new UIFileTableItem(createTreeItemData(UICustomFileSystemModel::strUpDirectoryString, 4096, 916 916 QDateTime(), QString(), QString()) 917 , parent, FileObjectType_Directory);917 , parent, KFsObjType_Directory); 918 918 item->setIsOpened(false); 919 919 map.insert(UICustomFileSystemModel::strUpDirectoryString, item); … … 1452 1452 } 1453 1453 1454 QString UIFileManagerTable::fileTypeString( FileObjectType type)1454 QString UIFileManagerTable::fileTypeString(KFsObjType type) 1455 1455 { 1456 1456 QString strType = UIFileManager::tr("Unknown"); 1457 1457 switch (type) 1458 1458 { 1459 case FileObjectType_File:1459 case KFsObjType_File: 1460 1460 strType = UIFileManager::tr("File"); 1461 1461 break; 1462 case FileObjectType_Directory:1462 case KFsObjType_Directory: 1463 1463 strType = UIFileManager::tr("Directory"); 1464 1464 break; 1465 case FileObjectType_SymLink:1465 case KFsObjType_Symlink: 1466 1466 strType = UIFileManager::tr("Symbolic Link"); 1467 1467 break; 1468 case FileObjectType_Other: 1469 strType = UIFileManager::tr("Other"); 1470 break; 1471 1472 case FileObjectType_Unknown: 1468 case KFsObjType_Unknown: 1473 1469 default: 1470 strType = UIFileManager::tr("Unknown"); 1474 1471 break; 1475 1472 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h
r76297 r76300 52 52 class UIToolBar; 53 53 54 /** @todo r=bird: Why don't you just use KFsObjType? */55 enum FileObjectType56 {57 FileObjectType_File = 0,58 FileObjectType_Directory,59 FileObjectType_SymLink,60 FileObjectType_Other,61 FileObjectType_Unknown,62 FileObjectType_Max63 };64 65 54 /** A simple struck to store some statictics for a directory. Mainly used by UIDirectoryDiskUsageComputer instances. */ 66 55 class UIDirectoryStatistics … … 170 159 * directory */ 171 160 explicit UIFileTableItem(const QVector<QVariant> &data, 172 UIFileTableItem *parentItem, FileObjectType type);161 UIFileTableItem *parentItem, KFsObjType type); 173 162 ~UIFileTableItem(); 174 163 … … 199 188 void clearChildren(); 200 189 201 FileObjectTypetype() const;190 KFsObjType type() const; 202 191 203 192 const QString &targetPath() const; … … 232 221 /** True if this is a symlink and the target is a directory */ 233 222 bool m_isTargetADirectory; 234 FileObjectTypem_type;223 KFsObjType m_type; 235 224 /** True if only this item represents a DOS style drive letter item */ 236 225 bool m_isDriveItem; … … 331 320 /** @} */ 332 321 333 QString fileTypeString( FileObjectType type);322 QString fileTypeString(KFsObjType type); 334 323 /* @p item index is item location in model not in 'proxy' model */ 335 324 void goIntoDirectory(const QModelIndex &itemIndex);
Note:
See TracChangeset
for help on using the changeset viewer.