Changeset 102418 in vbox
- Timestamp:
- Dec 1, 2023 11:47:43 AM (12 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp
r102404 r102418 514 514 } 515 515 516 voidUIFileManagerGuestTable::readDirectory(const QString& strPath,516 bool UIFileManagerGuestTable::readDirectory(const QString& strPath, 517 517 UICustomFileSystemItem *parent, bool isStartDir /*= false*/) 518 518 { 519 519 if (!parent) 520 return ;520 return false; 521 521 522 522 CGuestDirectory directory; … … 528 528 { 529 529 emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession), m_strTableName, FileManagerLogType_Error); 530 return ;530 return false; 531 531 } 532 532 … … 569 569 item->setData(fsInfo.GetUserName(), UICustomFileSystemModelData_Owner); 570 570 item->setData(permissionString(fsInfo), UICustomFileSystemModelData_Permissions); 571 printf(" %s === %s\n", qPrintable(fsInfo.GetName()), qPrintable(fsInfo.GetFileAttributes())); 571 572 item->setIsOpened(false); 572 573 item->setIsHidden(isFileObjectHidden(fsInfo)); … … 596 597 checkDotDot(fileObjects, parent, isStartDir); 597 598 } 598 599 else 600 { 601 directory.Close(); 602 return false; 603 } 599 604 directory.Close(); 605 return true; 600 606 } 601 607 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.h
r102393 r102418 81 81 82 82 void retranslateUi() override final; 83 virtual voidreadDirectory(const QString& strPath, UICustomFileSystemItem *parent, bool isStartDir = false) override final;83 virtual bool readDirectory(const QString& strPath, UICustomFileSystemItem *parent, bool isStartDir = false) override final; 84 84 virtual void deleteByItem(UICustomFileSystemItem *item) override final; 85 85 virtual void goToHomeDirectory() override final; -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.cpp
r102393 r102418 135 135 UIFileManagerHostTable::UIFileManagerHostTable(UIActionPool *pActionPool, QWidget *pParent /* = 0 */) 136 136 :UIFileManagerTable(pActionPool, pParent) 137 , m_pModifierActionSeparator(0) 137 138 { 138 139 setModelFileSystem(isWindowsFileSystem()); … … 144 145 } 145 146 146 /* static */ void UIFileManagerHostTable::scanDirectory(const QString& strPath, UICustomFileSystemItem *parent, 147 void UIFileManagerHostTable::setModifierActionsVisible(bool fShown) 148 { 149 if (m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Delete)) 150 m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Delete)->setVisible(fShown); 151 if (m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Rename)) 152 m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Rename)->setVisible(fShown); 153 if (m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_CreateNewDirectory)) 154 m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_CreateNewDirectory)->setVisible(fShown); 155 if (m_pModifierActionSeparator) 156 m_pModifierActionSeparator->setVisible(fShown); 157 } 158 159 /* static */ bool UIFileManagerHostTable::scanDirectory(const QString& strPath, UICustomFileSystemItem *parent, 147 160 QMap<QString, UICustomFileSystemItem*> &fileObjects) 148 161 { … … 153 166 /*directory.setFilter(QDir::NoDotAndDotDot);*/ 154 167 parent->setIsOpened(true); 155 if (!directory.exists() )156 return ;168 if (!directory.exists() || !directory.isReadable()) 169 return false; 157 170 QFileInfoList entries = directory.entryInfoList(QDir::Hidden|QDir::AllEntries|QDir::NoDotAndDotDot); 171 if (entries.isEmpty()) 172 return false; 158 173 for (int i = 0; i < entries.size(); ++i) 159 174 { … … 180 195 item->setIsOpened(false); 181 196 } 197 return true; 182 198 } 183 199 … … 199 215 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_GoHome)); 200 216 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Refresh)); 201 m_pToolBar->addSeparator(); 217 218 m_pModifierActionSeparator = m_pToolBar->addSeparator(); 202 219 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Delete)); 203 220 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Rename)); 204 221 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_CreateNewDirectory)); 205 // m_pToolBar->addSeparator(); 222 206 223 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Copy)); 207 224 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Cut)); … … 267 284 } 268 285 269 voidUIFileManagerHostTable::readDirectory(const QString& strPath, UICustomFileSystemItem *parent, bool isStartDir /*= false*/)286 bool UIFileManagerHostTable::readDirectory(const QString& strPath, UICustomFileSystemItem *parent, bool isStartDir /*= false*/) 270 287 { 271 288 if (!parent) 272 return ;289 return false; 273 290 274 291 QMap<QString, UICustomFileSystemItem*> fileObjects; 275 scanDirectory(strPath, parent, fileObjects); 292 if (!scanDirectory(strPath, parent, fileObjects)) 293 return false; 276 294 checkDotDot(fileObjects, parent, isStartDir); 295 return true; 277 296 } 278 297 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.h
r102393 r102418 51 51 52 52 UIFileManagerHostTable(UIActionPool *pActionPool, QWidget *pParent = 0); 53 /** Hide delete, rename, new folder actions. */ 54 void setModifierActionsVisible(bool fShown); 55 53 56 static KFsObjType fileType(const QFileInfo &fsInfo); 54 57 static KFsObjType fileType(const QString &strPath); … … 58 61 /** Scans the directory with the path @strPath and inserts items to the 59 62 * tree under the @p parent. */ 60 static voidscanDirectory(const QString& strPath, UICustomFileSystemItem *parent,63 static bool scanDirectory(const QString& strPath, UICustomFileSystemItem *parent, 61 64 QMap<QString, UICustomFileSystemItem*> &fileObjects); 62 65 void retranslateUi() override final; 63 virtual voidreadDirectory(const QString& strPath, UICustomFileSystemItem *parent, bool isStartDir = false) override final;66 virtual bool readDirectory(const QString& strPath, UICustomFileSystemItem *parent, bool isStartDir = false) override final; 64 67 virtual void deleteByItem(UICustomFileSystemItem *item) override final; 65 68 virtual void goToHomeDirectory() override final; … … 85 88 static QString permissionString(QFileDevice::Permissions permissions); 86 89 void prepareActionConnections(); 90 91 QAction *m_pModifierActionSeparator; 87 92 }; 88 93 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp
r102393 r102418 687 687 { 688 688 if (!item->isOpened()) 689 readDirectory(item->path(),item); 690 changeLocation(index); 689 { 690 if (readDirectory(item->path(),item)) 691 changeLocation(index); 692 } 693 else 694 changeLocation(index); 691 695 } 692 696 } … … 702 706 /* Make sure parent is already opened: */ 703 707 if (!parent->isOpened()) 704 readDirectory(parent->path(), parent, parent == getStartDirectoryItem()); 708 if (!readDirectory(parent->path(), parent, parent == getStartDirectoryItem())) 709 return; 705 710 /* search the current path item among the parent's children: */ 706 711 UICustomFileSystemItem *item = parent->child(pathTrail.at(i)); … … 713 718 return; 714 719 if (!parent->isOpened()) 715 readDirectory(parent->path(), parent, parent == getStartDirectoryItem()); 720 { 721 if (!readDirectory(parent->path(), parent, parent == getStartDirectoryItem())) 722 return; 723 } 716 724 goIntoDirectory(parent); 717 725 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h
r102393 r102418 211 211 void checkDotDot(QMap<QString,UICustomFileSystemItem*> &map, UICustomFileSystemItem *parent, bool isStartDir); 212 212 213 virtual voidreadDirectory(const QString& strPath, UICustomFileSystemItem *parent, bool isStartDir = false) = 0;213 virtual bool readDirectory(const QString& strPath, UICustomFileSystemItem *parent, bool isStartDir = false) = 0; 214 214 virtual void deleteByItem(UICustomFileSystemItem *item) = 0; 215 215 virtual void goToHomeDirectory() = 0; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r102404 r102418 491 491 AssertPtrReturnVoid(m_pHostFileBrowser); 492 492 pContainerLayout->addWidget(m_pHostFileBrowser, 0, 0, 1, 4); 493 m_pHostFileBrowser->setModifierActionsVisible(false); 493 494 494 495 prepareVerticalToolBar();
Note:
See TracChangeset
for help on using the changeset viewer.