Changeset 100629 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 18, 2023 12:35:45 PM (19 months ago)
- svn:sync-xref-src-repo-rev:
- 158460
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/medium/viso
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoBrowserBase.h
r100478 r100629 62 62 ~UIVisoBrowserBase(); 63 63 virtual void showHideHiddenObjects(bool bShow) = 0; 64 virtual bool tableViewHasSelection() const = 0;65 64 66 65 public slots: -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp
r100605 r100629 179 179 void sigNewItemsDropped(QStringList pathList); 180 180 181 181 182 public: 182 183 … … 185 186 void dropEvent(QDropEvent *event); 186 187 void dragMoveEvent(QDragMoveEvent *event); 188 bool hasSelection() const; 187 189 }; 188 190 … … 199 201 { 200 202 event->acceptProposedAction(); 203 } 204 205 bool UIVisoContentTableView::hasSelection() const 206 { 207 if (!selectionModel()) 208 return false; 209 return selectionModel()->hasSelection(); 201 210 } 202 211 … … 643 652 AssertReturnVoid(m_pGoBackward); 644 653 645 m_pRemoveAction->setEnabled( tableViewHasSelection());646 m_pRestoreAction->setEnabled( tableViewHasSelection());647 m_pRenameAction->setEnabled( tableViewHasSelection());654 m_pRemoveAction->setEnabled(m_pTableView->hasSelection()); 655 m_pRestoreAction->setEnabled(m_pTableView->hasSelection()); 656 m_pRenameAction->setEnabled(m_pTableView->hasSelection()); 648 657 649 658 m_pToolBar->addAction(m_pGoBackward); … … 787 796 if (m_pGoUp) 788 797 m_pGoUp->setEnabled(!onStartItem()); 798 m_pTableView->clearSelection(); 799 enableDisableSelectionDependentActions(); 789 800 } 790 801 … … 820 831 { 821 832 Q_UNUSED(bShow); 822 }823 824 bool UIVisoContentBrowser::tableViewHasSelection() const825 {826 if (!m_pTableView)827 return false;828 QItemSelectionModel *pSelectionModel = m_pTableView->selectionModel();829 if (!pSelectionModel)830 return false;831 return pSelectionModel->hasSelection();832 833 } 833 834 … … 1079 1080 emit sigTableSelectionChanged(selected.isEmpty()); 1080 1081 1081 if (m_pRemoveAction) 1082 m_pRemoveAction->setEnabled(!selected.isEmpty()); 1083 if (m_pRestoreAction) 1084 m_pRestoreAction->setEnabled(!selected.isEmpty()); 1085 if (m_pRenameAction) 1086 m_pRenameAction->setEnabled(!selected.isEmpty()); 1082 enableDisableSelectionDependentActions(); 1087 1083 } 1088 1084 … … 1091 1087 if (!rootItem() || !rootItem()->child(0)) 1092 1088 return; 1089 goToStart(); 1093 1090 rootItem()->child(0)->removeChildren(); 1094 1091 m_entryMap.clear(); … … 1174 1171 /* Go up if we are not already in root: */ 1175 1172 if (!onStartItem()) 1176 {1177 1173 setTableRootIndex(currentRoot.parent()); 1178 } 1174 } 1175 1176 void UIVisoContentBrowser::goToStart() 1177 { 1178 while(!onStartItem()) 1179 goUp(); 1179 1180 } 1180 1181 … … 1202 1203 } 1203 1204 1205 void UIVisoContentBrowser::enableDisableSelectionDependentActions() 1206 { 1207 AssertReturnVoid(m_pTableView); 1208 1209 bool fSelection = m_pTableView->hasSelection(); 1210 if (m_pRemoveAction) 1211 m_pRemoveAction->setEnabled(fSelection); 1212 if (m_pRestoreAction) 1213 m_pRestoreAction->setEnabled(fSelection); 1214 if (m_pRenameAction) 1215 m_pRenameAction->setEnabled(fSelection); 1216 } 1217 1204 1218 #include "UIVisoContentBrowser.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.h
r100601 r100629 73 73 QStringList entryList(); 74 74 virtual void showHideHiddenObjects(bool bShow) override final; 75 virtual bool tableViewHasSelection() const final override; 75 76 76 void parseVisoFileContent(const QString &strFileName); 77 77 void prepareMainMenu(QMenu *pMenu); … … 134 134 QString currentPath() const; 135 135 UICustomFileSystemItem* searchItemByPath(const QString &strPath); 136 136 void goToStart(); 137 137 /** Returns a list of items which are currecntly selected 138 138 * in the table view. */ … … 147 147 const UICustomFileSystemItem* currentDirectoryItem() const; 148 148 void markRemovedUnremovedItemParents(UICustomFileSystemItem *pItem, bool fRemoved); 149 void enableDisableSelectionDependentActions(); 149 150 UIVisoContentTableView *m_pTableView; 150 151 UICustomFileSystemModel *m_pModel; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoHostBrowser.h
r100559 r100629 58 58 QString currentPath() const; 59 59 void setCurrentPath(const QString &strPath); 60 virtual bool tableViewHasSelection() const final override;60 bool tableViewHasSelection() const; 61 61 /* The list of path of the selected file objects. */ 62 62 QStringList selectedPathList() const;
Note:
See TracChangeset
for help on using the changeset viewer.