Changeset 75162 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 29, 2018 7:01:25 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/guestctrl
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.cpp
r75148 r75162 92 92 virtual void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected) /*override */; 93 93 void contextMenuEvent(QContextMenuEvent *pEvent); 94 //void keyPressEvent(QKeyEvent * pEvent);95 94 96 95 private: … … 1110 1109 m_pModel->endReset(); 1111 1110 m_pView->setRootIndex(m_pProxyModel->mapFromSource(currentIndex)); 1111 setSelectionDependentActionsEnabled(m_pView->hasSelection()); 1112 1112 } 1113 1113 … … 1208 1208 Q_UNUSED(selected); 1209 1209 Q_UNUSED(deselected); 1210 if (m_pView->hasSelection()) 1211 enableSelectionDependentActions(); 1212 else 1213 disableSelectionDependentActions(); 1214 } 1215 1210 setSelectionDependentActionsEnabled(m_pView->hasSelection()); 1211 } 1216 1212 1217 1213 void UIGuestControlFileTable::prepareActionConnections() … … 1483 1479 } 1484 1480 1485 void UIGuestControlFileTable::enableSelectionDependentActions() 1486 { 1487 for (int i = 0; i < m_selectionDependentActions.size(); ++i) 1488 { 1489 if (m_selectionDependentActions[i]) 1490 m_selectionDependentActions[i]->setEnabled(true); 1491 } 1492 } 1493 1494 void UIGuestControlFileTable::disableSelectionDependentActions() 1495 { 1496 /* Disable all the action that operate on some selection: */ 1497 for (int i = 0; i < m_selectionDependentActions.size(); ++i) 1498 { 1499 if (m_selectionDependentActions[i]) 1500 m_selectionDependentActions[i]->setEnabled(false); 1481 void UIGuestControlFileTable::setSelectionDependentActionsEnabled(bool fIsEnabled) 1482 { 1483 foreach (QAction *pAction, m_selectionDependentActions) 1484 { 1485 pAction->setEnabled(fIsEnabled); 1501 1486 } 1502 1487 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.h
r75148 r75162 293 293 bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */; 294 294 CGuestFsObjInfo guestFsObjectInfo(const QString& path, CGuestSession &comGuestSession) const; 295 void enableSelectionDependentActions(); 296 void disableSelectionDependentActions(); 295 void setSelectionDependentActionsEnabled(bool fIsEnabled); 297 296 void prepareActionConnections(); 298 297 … … 307 306 * systems this is empty and for windows system it should at least contain C:/ */ 308 307 QStringList m_driveLetterList; 309 308 /** The set of actions which need some selection to work on. Like cut, copy etc. */ 309 QSet<QAction*> m_selectionDependentActions; 310 310 311 311 protected slots: … … 362 362 QGridLayout *m_pMainLayout; 363 363 QComboBox *m_pLocationComboBox; 364 //QAction *m_pGoUp;365 //QAction *m_pGoHome;366 //QAction *m_pRefresh;367 //QAction *m_pDelete;368 //QAction *m_pRename;369 //QAction *m_pCreateNewDirectory;370 // QAction *m_pShowProperties;371 // QAction *m_pSelectAll;372 // QAction *m_pInvertSelection;373 /** The vector of actions which need some selection to work on. Like cut, copy etc. */374 QVector<QAction*> m_selectionDependentActions;375 364 /** The absolue path list of the file objects which user has chosen to cut/copy. this 376 365 * list will be cleaned after a paste operation or overwritten by a subsequent cut/copy */ -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestFileTable.cpp
r75157 r75162 611 611 m_pToolBar->addSeparator(); 612 612 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_ShowProperties)); 613 } 614 615 disableSelectionDependentActions(); 613 614 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Delete)); 615 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Rename)); 616 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Copy)); 617 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Cut)); 618 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_ShowProperties)); 619 620 } 621 setSelectionDependentActionsEnabled(false); 616 622 } 617 623 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIHostFileTable.cpp
r75148 r75162 148 148 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_GoHome)); 149 149 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Refresh)); 150 151 150 m_pToolBar->addSeparator(); 152 151 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Delete)); … … 162 161 m_pToolBar->addSeparator(); 163 162 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_ShowProperties)); 163 164 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Delete)); 165 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Rename)); 166 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Copy)); 167 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Cut)); 168 m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_ShowProperties)); 164 169 } 165 170 … … 172 177 // if (m_pPaste) 173 178 // m_pPaste->setVisible(false); 174 175 disableSelectionDependentActions(); 179 setSelectionDependentActionsEnabled(false); 176 180 } 177 181
Note:
See TracChangeset
for help on using the changeset viewer.