Changeset 76626 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 3, 2019 9:18:50 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r76606 r76626 203 203 const char *UIExtraDataDefs::GUI_GuestControl_FileManagerShowDeleteConfirmation = "ShowDeleteConfimation"; 204 204 const char *UIExtraDataDefs::GUI_GuestControl_FileManagerShowHumanReadableSizes = "ShowHumanReadableSizes"; 205 const char *UIExtraDataDefs::GUI_GuestControl_FileManagerShowHiddenObjects = "ShowHiddenObjects"; 205 206 206 207 /* Virtual Machine: Close dialog: */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r76581 r76626 374 374 extern const char *GUI_GuestControl_FileManagerShowDeleteConfirmation; 375 375 extern const char *GUI_GuestControl_FileManagerShowHumanReadableSizes; 376 extern const char *GUI_GuestControl_FileManagerShowHiddenObjects; 376 377 /** @} */ 377 378 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r76606 r76626 4240 4240 4241 4241 void UIExtraDataManager::setFileManagerOptions(bool fListDirectoriesFirst, 4242 bool fShowDeleteConfirmation, bool fShowHumanReadableSizes) 4242 bool fShowDeleteConfirmation, 4243 bool fShowHumanReadableSizes, 4244 bool fShowHiddenObjects) 4243 4245 { 4244 4246 /* Serialize passed values: */ … … 4251 4253 if (fShowHumanReadableSizes) 4252 4254 data << GUI_GuestControl_FileManagerShowHumanReadableSizes; 4253 4255 if (fShowHiddenObjects) 4256 data << GUI_GuestControl_FileManagerShowHiddenObjects; 4254 4257 /* Re-cache corresponding extra-data: */ 4255 4258 setExtraDataStringList(GUI_GuestControl_FileManagerOptions, data); … … 4284 4287 { 4285 4288 if (data[i] == GUI_GuestControl_FileManagerShowHumanReadableSizes) 4289 return true; 4290 } 4291 return false; 4292 } 4293 4294 bool UIExtraDataManager::fileManagerShowHiddenObjects() 4295 { 4296 const QStringList data = extraDataStringList(GUI_GuestControl_FileManagerOptions); 4297 for (int i = 0; i < data.size(); ++i) 4298 { 4299 if (data[i] == GUI_GuestControl_FileManagerShowHiddenObjects) 4286 4300 return true; 4287 4301 } -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r76581 r76626 654 654 * @{ */ 655 655 void setFileManagerOptions(bool fListDirectoriesFirst, 656 bool fShowDeleteConfirmation, bool fshowHumanReadableSizes); 656 bool fShowDeleteConfirmation, 657 bool fshowHumanReadableSizes, 658 bool fShowHiddenObjects); 657 659 bool fileManagerListDirectoriesFirst(); 658 660 bool fileManagerShowDeleteConfirmation(); 659 661 bool fileManagerShowHumanReadableSizes(); 662 bool fileManagerShowHiddenObjects(); 660 663 /** @} */ 661 664 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.cpp
r76621 r76626 37 37 : m_parentItem(parent) 38 38 , m_bIsOpened(false) 39 , m_ isTargetADirectory(false)39 , m_fIsTargetADirectory(false) 40 40 , m_type(type) 41 , m_isDriveItem(false) 41 , m_fIsDriveItem(false) 42 , m_fIsHidden(false) 42 43 { 43 44 for (int i = static_cast<int>(UICustomFileSystemModelColumn_Name); … … 201 202 bool UICustomFileSystemItem::isSymLinkToADirectory() const 202 203 { 203 return m_ isTargetADirectory;204 return m_fIsTargetADirectory; 204 205 } 205 206 206 207 void UICustomFileSystemItem::setIsSymLinkToADirectory(bool flag) 207 208 { 208 m_ isTargetADirectory = flag;209 m_fIsTargetADirectory = flag; 209 210 } 210 211 211 212 bool UICustomFileSystemItem::isSymLinkToAFile() const 212 213 { 213 return isSymLink() && !m_ isTargetADirectory;214 return isSymLink() && !m_fIsTargetADirectory; 214 215 } 215 216 216 217 void UICustomFileSystemItem::setIsDriveItem(bool flag) 217 218 { 218 m_ isDriveItem = flag;219 m_fIsDriveItem = flag; 219 220 } 220 221 221 222 bool UICustomFileSystemItem::isDriveItem() const 222 223 { 223 return m_isDriveItem; 224 return m_fIsDriveItem; 225 } 226 227 void UICustomFileSystemItem::setIsHidden(bool flag) 228 { 229 m_fIsHidden = flag; 230 } 231 232 bool UICustomFileSystemItem::isHidden() const 233 { 234 return m_fIsHidden; 224 235 } 225 236 … … 229 240 *********************************************************************************************************************************/ 230 241 231 bool UICustomFileSystemProxyModel::listDirectoriesOnTop() const 232 { 233 return m_fListDirectoriesOnTop; 242 UICustomFileSystemProxyModel::UICustomFileSystemProxyModel(QObject *parent /* = 0 */) 243 :QSortFilterProxyModel(parent) 244 , m_fListDirectoriesOnTop(false) 245 , m_fShowHiddenObjects(true) 246 { 234 247 } 235 248 … … 276 289 } 277 290 278 UICustomFileSystemProxyModel::UICustomFileSystemProxyModel(QObject *parent /* = 0 */) 279 :QSortFilterProxyModel(parent) 280 , m_fListDirectoriesOnTop(false) 281 { 291 bool UICustomFileSystemProxyModel::filterAcceptsRow(int iSourceRow, const QModelIndex &sourceParent) const 292 { 293 if (m_fShowHiddenObjects) 294 return true; 295 296 QModelIndex itemIndex = sourceModel()->index(iSourceRow, 0, sourceParent); 297 if (!itemIndex.isValid()) 298 return false; 299 300 UICustomFileSystemItem *item = static_cast<UICustomFileSystemItem*>(itemIndex.internalPointer()); 301 if (!item) 302 return false; 303 304 if (item->isHidden()) 305 return false; 306 307 return true; 282 308 } 283 309 … … 285 311 { 286 312 m_fListDirectoriesOnTop = fListDirectoriesOnTop; 313 } 314 315 bool UICustomFileSystemProxyModel::listDirectoriesOnTop() const 316 { 317 return m_fListDirectoriesOnTop; 318 } 319 320 void UICustomFileSystemProxyModel::setShowHiddenObjects(bool fShowHiddenObjects) 321 { 322 m_fShowHiddenObjects = fShowHiddenObjects; 323 } 324 325 bool UICustomFileSystemProxyModel::showHiddenObjects() const 326 { 327 return m_fShowHiddenObjects; 287 328 } 288 329 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.h
r76621 r76626 98 98 bool isDriveItem() const; 99 99 100 void setIsHidden(bool flag); 101 bool isHidden() const; 102 100 103 private: 101 104 void appendChild(UICustomFileSystemItem *child); … … 110 113 QString m_strTargetPath; 111 114 /** True if this is a symlink and the target is a directory */ 112 bool m_ isTargetADirectory;115 bool m_fIsTargetADirectory; 113 116 KFsObjType m_type; 114 117 /** True if only this item represents a DOS style drive letter item */ 115 bool m_isDriveItem; 118 bool m_fIsDriveItem; 119 /** True if the file object is hidden in the file system. */ 120 bool m_fIsHidden; 116 121 }; 117 122 … … 126 131 127 132 UICustomFileSystemProxyModel(QObject *parent = 0); 133 128 134 void setListDirectoriesOnTop(bool fListDirectoriesOnTop); 129 135 bool listDirectoriesOnTop() const; 130 136 137 void setShowHiddenObjects(bool fShowHiddenObjects); 138 bool showHiddenObjects() const; 139 131 140 protected: 132 141 133 bool lessThan(const QModelIndex &left, const QModelIndex &right) const /* override */; 142 virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const /* override */; 143 /** Currently filters out hidden objects if options is set to "not showing them". */ 144 virtual bool filterAcceptsRow(int iSourceRow, const QModelIndex &sourceParent) const /* override */; 134 145 135 146 private: 136 147 137 148 bool m_fListDirectoriesOnTop; 149 bool m_fShowHiddenObjects; 138 150 }; 139 151 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp
r76606 r76626 108 108 , bAskDeleteConfirmation(false) 109 109 , bShowHumanReadableSizes(true) 110 , bShowHiddenObjects(true) 110 111 { 111 112 } … … 700 701 { 701 702 gEDataManager->setFileManagerOptions(pOptions->bListDirectoriesOnTop, 702 pOptions->bAskDeleteConfirmation, 703 pOptions->bShowHumanReadableSizes); 703 pOptions->bAskDeleteConfirmation, 704 pOptions->bShowHumanReadableSizes, 705 pOptions->bShowHiddenObjects); 704 706 } 705 707 } … … 740 742 pOptions->bAskDeleteConfirmation = gEDataManager->fileManagerShowDeleteConfirmation(); 741 743 pOptions->bShowHumanReadableSizes = gEDataManager->fileManagerShowHumanReadableSizes(); 744 pOptions->bShowHiddenObjects = gEDataManager->fileManagerShowHiddenObjects(); 742 745 } 743 746 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.h
r76581 r76626 73 73 bool bAskDeleteConfirmation; 74 74 bool bShowHumanReadableSizes; 75 bool bShowHiddenObjects; 75 76 76 77 private: -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp
r76606 r76626 211 211 item->setPath(UIPathOperations::mergePaths(strPath, fsInfo.GetName())); 212 212 item->setIsOpened(false); 213 item->setIsHidden(isFileObjectHidden(fsInfo)); 213 214 fileObjects.insert(fsInfo.GetName(), item); 214 215 /* @todo. We will need to wait a fully implemented SymlinkRead function … … 738 739 } 739 740 741 bool UIFileManagerGuestTable::isFileObjectHidden(const CFsObjInfo &fsInfo) 742 { 743 QString strAttributes = fsInfo.GetFileAttributes(); 744 745 if (strAttributes.isEmpty()) 746 return false; 747 748 int offSpace = strAttributes.indexOf(' '); 749 if (offSpace < 0) 750 offSpace = strAttributes.length(); 751 QString strRight(strAttributes.mid(offSpace + 1).trimmed()); 752 753 if (strRight.indexOf('H', Qt::CaseSensitive) == -1) 754 return false; 755 return true; 756 } 757 740 758 #include "UIFileManagerGuestTable.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.h
r76581 r76626 83 83 bool checkGuestSession(); 84 84 QString permissionString(const CFsObjInfo &fsInfo); 85 bool isFileObjectHidden(const CFsObjInfo &fsInfo); 86 85 87 mutable CGuestSession m_comGuestSession; 86 88 }; -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.cpp
r76621 r76626 162 162 item->setIsSymLinkToADirectory(QFileInfo(fileInfo.symLinkTarget()).isDir()); 163 163 } 164 item->setIsHidden(fileInfo.isHidden()); 164 165 fileObjects.insert(fileInfo.fileName(), item); 165 166 item->setIsOpened(false); -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerOptionsPanel.cpp
r76606 r76626 38 38 , m_pDeleteConfirmationCheckBox(0) 39 39 , m_pHumanReabableSizesCheckBox(0) 40 , m_pShowHiddenObjectsCheckBox(0) 40 41 , m_pFileManagerOptions(pFileManagerOptions) 41 42 { … … 73 74 m_pHumanReabableSizesCheckBox->blockSignals(false); 74 75 } 76 77 if (m_pShowHiddenObjectsCheckBox) 78 { 79 m_pShowHiddenObjectsCheckBox->blockSignals(true); 80 m_pShowHiddenObjectsCheckBox->setChecked(m_pFileManagerOptions->bShowHiddenObjects); 81 m_pShowHiddenObjectsCheckBox->blockSignals(false); 82 } 75 83 } 76 84 … … 97 105 mainLayout()->addWidget(m_pHumanReabableSizesCheckBox, 0, Qt::AlignLeft); 98 106 } 107 108 m_pShowHiddenObjectsCheckBox = new QCheckBox; 109 if (m_pShowHiddenObjectsCheckBox) 110 { 111 mainLayout()->addWidget(m_pShowHiddenObjectsCheckBox, 0, Qt::AlignLeft); 112 } 113 99 114 /* Set initial checkbox status wrt. options: */ 100 115 if (m_pFileManagerOptions) … … 106 121 if (m_pHumanReabableSizesCheckBox) 107 122 m_pHumanReabableSizesCheckBox->setChecked(m_pFileManagerOptions->bShowHumanReadableSizes); 123 if (m_pShowHiddenObjectsCheckBox) 124 m_pShowHiddenObjectsCheckBox->setChecked(m_pFileManagerOptions->bShowHiddenObjects); 125 108 126 } 109 127 retranslateUi(); … … 135 153 } 136 154 155 void UIFileManagerOptionsPanel::sltShowHiddenObjectsCheckBoxToggled(bool bChecked) 156 { 157 if (!m_pFileManagerOptions) 158 return; 159 m_pFileManagerOptions->bShowHiddenObjects = bChecked; 160 emit sigOptionsChanged(); 161 } 162 137 163 void UIFileManagerOptionsPanel::prepareConnections() 138 164 { … … 146 172 connect(m_pHumanReabableSizesCheckBox, &QCheckBox::toggled, 147 173 this, &UIFileManagerOptionsPanel::sltHumanReabableSizesCheckBoxToogled); 174 175 if (m_pShowHiddenObjectsCheckBox) 176 connect(m_pShowHiddenObjectsCheckBox, &QCheckBox::toggled, 177 this, &UIFileManagerOptionsPanel::sltShowHiddenObjectsCheckBoxToggled); 178 148 179 } 149 180 … … 170 201 "readable format rather than in bytes")); 171 202 } 172 } 203 204 if (m_pShowHiddenObjectsCheckBox) 205 { 206 m_pShowHiddenObjectsCheckBox->setText(UIFileManager::tr("Show hidden objects")); 207 m_pShowHiddenObjectsCheckBox->setToolTip(UIFileManager::tr("Show hidden files/directories")); 208 } 209 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerOptionsPanel.h
r76581 r76626 64 64 void sltDeleteConfirmationCheckBoxToogled(bool bChecked); 65 65 void sltHumanReabableSizesCheckBoxToogled(bool bChecked); 66 void sltShowHiddenObjectsCheckBoxToggled(bool bChecked); 66 67 67 68 private: … … 70 71 QCheckBox *m_pDeleteConfirmationCheckBox; 71 72 QCheckBox *m_pHumanReabableSizesCheckBox; 73 QCheckBox *m_pShowHiddenObjectsCheckBox; 72 74 UIFileManagerOptions *m_pFileManagerOptions; 73 75 }; -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp
r76606 r76626 1160 1160 { 1161 1161 if (m_pProxyModel) 1162 { 1162 1163 m_pProxyModel->setListDirectoriesOnTop(pOptions->bListDirectoriesOnTop); 1164 m_pProxyModel->setShowHiddenObjects(pOptions->bShowHiddenObjects); 1165 } 1163 1166 if (m_pModel) 1164 1167 m_pModel->setShowHumanReadableSizes(pOptions->bShowHumanReadableSizes);
Note:
See TracChangeset
for help on using the changeset viewer.