- Timestamp:
- Dec 16, 2021 12:20:49 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/guestctrl
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp
r92947 r92979 476 476 Q_UNUSED(iIndex); 477 477 setVerticalToolBarActionsEnabled(); 478 479 /* Mark the current guest table: */ 480 UIFileManagerGuestTable *pCurrentGuestTable = currentGuestTable(); 481 for (int i = 0; i < m_pGuestTablesContainer->count(); ++i) 482 { 483 UIFileManagerGuestTable *pTable = qobject_cast<UIFileManagerGuestTable*>(m_pGuestTablesContainer->widget(i)); 484 if (!pTable) 485 continue; 486 pTable->setIsCurrent(pTable == pCurrentGuestTable); 487 } 478 488 } 479 489 … … 700 710 selectedMachines << item->id(); 701 711 } 712 QUuid lastSelection = selectedMachines.isEmpty() ? QUuid() : selectedMachines.last(); 702 713 /** Iterate through the current tabs and add any machine id for which we have a running guest session to the 703 714 * list of machine ids we want to have a tab for: */ … … 711 722 } 712 723 713 setMachines(selectedMachines );714 } 715 716 void UIFileManager::setMachines(const QVector<QUuid> &machineIds )724 setMachines(selectedMachines, lastSelection); 725 } 726 727 void UIFileManager::setMachines(const QVector<QUuid> &machineIds, const QUuid &lastSelectedMachineId /* = QUuid() */) 717 728 { 718 729 AssertReturnVoid(m_pGuestTablesContainer); … … 732 743 addTabs(newSelections); 733 744 removeTabs(unselectedMachines); 734 m_pGuestTablesContainer->setCurrentIndex(m_pGuestTablesContainer->count()-1); 745 if (!lastSelectedMachineId.isNull()) 746 { 747 int iIndexToSelect = -1; 748 for (int i = 0; i < m_pGuestTablesContainer->count() && iIndexToSelect == -1; ++i) 749 { 750 UIFileManagerGuestTable *pTable = qobject_cast<UIFileManagerGuestTable*>(m_pGuestTablesContainer->widget(i)); 751 if (!pTable) 752 continue; 753 if (lastSelectedMachineId == pTable->machineId()) 754 iIndexToSelect = i; 755 } 756 if (iIndexToSelect != -1) 757 m_pGuestTablesContainer->setCurrentIndex(iIndexToSelect); 758 } 735 759 } 736 760 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.h
r92947 r92979 151 151 void savePanelVisibility(); 152 152 153 void setMachines(const QVector<QUuid> &machineIDs );153 void setMachines(const QVector<QUuid> &machineIDs, const QUuid &lastSelectedMachineId = QUuid()); 154 154 void removeTabs(const QVector<QUuid> &machineIdsToRemove); 155 155 void addTabs(const QVector<QUuid> &machineIdsToAdd); -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp
r92947 r92979 378 378 , m_comMachine(comMachine) 379 379 , m_pGuestSessionPanel(0) 380 , m_fIsCurrent(false) 380 381 { 381 382 if (!m_comMachine.isNull()) … … 653 654 } 654 655 656 void UIFileManagerGuestTable::setIsCurrent(bool fIsCurrent) 657 { 658 if (m_fIsCurrent == fIsCurrent) 659 return; 660 m_fIsCurrent = fIsCurrent; 661 prepareActionConnections(); 662 } 663 655 664 void UIFileManagerGuestTable::copyGuestToHost(const QString& hostDestinationPath) 656 665 { … … 984 993 } 985 994 995 void UIFileManagerGuestTable::manageConnection(bool fConnect, QAction *pAction, void (UIFileManagerGuestTable::*fptr)(void)) 996 { 997 if (!pAction || !fptr) 998 return; 999 if (fConnect) 1000 connect(pAction, &QAction::triggered, this, fptr); 1001 else 1002 disconnect(pAction, 0, this, 0); 1003 } 1004 986 1005 void UIFileManagerGuestTable::prepareActionConnections() 987 1006 { 988 1007 if (m_pActionPool->action(UIActionIndex_M_FileManager_T_GuestSession)) 989 connect(m_pActionPool->action(UIActionIndex_M_FileManager_T_GuestSession), &QAction::toggled, 990 this, &UIFileManagerGuestTable::sltGuestSessionPanelToggled); 991 992 connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoUp), &QAction::triggered, 993 this, &UIFileManagerTable::sltGoUp); 994 connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoHome), &QAction::triggered, 995 this, &UIFileManagerTable::sltGoHome); 996 connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Refresh), &QAction::triggered, 997 this, &UIFileManagerTable::sltRefresh); 998 connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Delete), &QAction::triggered, 999 this, &UIFileManagerTable::sltDelete); 1000 connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Rename), &QAction::triggered, 1001 this, &UIFileManagerTable::sltRename); 1002 connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Copy), &QAction::triggered, 1003 this, &UIFileManagerTable::sltCopy); 1004 connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Cut), &QAction::triggered, 1005 this, &UIFileManagerTable::sltCut); 1006 connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Paste), &QAction::triggered, 1007 this, &UIFileManagerTable::sltPaste); 1008 connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_SelectAll), &QAction::triggered, 1009 this, &UIFileManagerTable::sltSelectAll); 1010 connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_InvertSelection), &QAction::triggered, 1011 this, &UIFileManagerTable::sltInvertSelection); 1012 connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_ShowProperties), &QAction::triggered, 1013 this, &UIFileManagerTable::sltShowProperties); 1014 connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_CreateNewDirectory), &QAction::triggered, 1015 this, &UIFileManagerTable::sltCreateNewDirectory); 1008 { 1009 if (m_fIsCurrent) 1010 connect(m_pActionPool->action(UIActionIndex_M_FileManager_T_GuestSession), &QAction::toggled, 1011 this, &UIFileManagerGuestTable::sltGuestSessionPanelToggled); 1012 else 1013 disconnect(m_pActionPool->action(UIActionIndex_M_FileManager_T_GuestSession), 0, this, 0); 1014 } 1015 1016 manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoUp), &UIFileManagerTable::sltGoUp); 1017 manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoHome), &UIFileManagerTable::sltGoHome); 1018 manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Refresh), &UIFileManagerTable::sltRefresh); 1019 manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Delete), &UIFileManagerTable::sltDelete); 1020 manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Rename), &UIFileManagerTable::sltRename); 1021 manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Copy), &UIFileManagerTable::sltCopy); 1022 manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Cut), &UIFileManagerTable::sltCut); 1023 manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Paste), &UIFileManagerTable::sltPaste); 1024 manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_SelectAll), &UIFileManagerTable::sltSelectAll); 1025 manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_InvertSelection), &UIFileManagerTable::sltInvertSelection); 1026 manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_ShowProperties), &UIFileManagerTable::sltShowProperties); 1027 manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_CreateNewDirectory), &UIFileManagerTable::sltCreateNewDirectory); 1016 1028 } 1017 1029 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.h
r92917 r92979 65 65 QUuid machineId(); 66 66 bool isGuestSessionRunning() const; 67 void setIsCurrent(bool fIsCurrent); 67 68 68 69 protected: … … 142 143 void initFileTable(); 143 144 void cleanAll(); 144 145 void manageConnection(bool fConnect, QAction *pAction, void (UIFileManagerGuestTable::*fptr)(void)); 145 146 CGuest m_comGuest; 146 147 CGuestSession m_comGuestSession; … … 156 157 CEventListener m_comConsoleListener; 157 158 UIGuestSessionCreateWidget *m_pGuestSessionPanel; 158 ; 159 /** True if this table is the current table in parents tab widget. */ 160 bool m_fIsCurrent; 159 161 State m_enmState; 160 162 };
Note:
See TracChangeset
for help on using the changeset viewer.