Changeset 39601 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Dec 14, 2011 9:48:17 AM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r39326 r39601 419 419 { 420 420 /* Check if current item could be removed: */ 421 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_RemoveDialog, items[i] ))421 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_RemoveDialog, items[i], items)) 422 422 continue; 423 423 … … 468 468 { 469 469 /* Check if current item could be started/showed: */ 470 if (!isActionEnabled(UIActionIndexSelector_State_Machine_StartOrShow, items[i] ))470 if (!isActionEnabled(UIActionIndexSelector_State_Machine_StartOrShow, items[i], items)) 471 471 continue; 472 472 … … 521 521 522 522 /* Check if current item could be paused/resumed: */ 523 if (!isActionEnabled(UIActionIndexSelector_Toggle_Machine_PauseAndResume, pItem ))523 if (!isActionEnabled(UIActionIndexSelector_Toggle_Machine_PauseAndResume, pItem, items)) 524 524 continue; 525 525 … … 580 580 581 581 /* Check if current item could be reseted: */ 582 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_Reset, pItem ))582 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_Reset, pItem, items)) 583 583 continue; 584 584 … … 618 618 619 619 /* Check if current item could be shutdowned: */ 620 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, pItem ))620 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, pItem, items)) 621 621 continue; 622 622 … … 656 656 657 657 /* Check if current item could be powered off: */ 658 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_PowerOff, pItem ))658 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_PowerOff, pItem, items)) 659 659 continue; 660 660 … … 690 690 691 691 /* Check if current item could be refreshed: */ 692 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_Refresh, pItem ))692 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_Refresh, pItem, items)) 693 693 continue; 694 694 … … 711 711 712 712 /* Check if log could be show for the current item: */ 713 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_LogDialog, pItem ))713 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_LogDialog, pItem, items)) 714 714 continue; 715 715 … … 732 732 733 733 /* Check if that item could be shown in file-browser: */ 734 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_ShowInFileManager, pItem ))734 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_ShowInFileManager, pItem, items)) 735 735 continue; 736 736 … … 753 753 754 754 /* Check if shortcuts could be created for this item: */ 755 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_CreateShortcut, pItem ))755 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_CreateShortcut, pItem, items)) 756 756 continue; 757 757 … … 781 781 /* Get current item: */ 782 782 UIVMItem *pItem = m_pVMListView->currentItem(); 783 /* Get selected items: */ 784 QList<UIVMItem*> items = m_pVMListView->currentItems(); 783 785 AssertMsgReturnVoid(pItem, ("Current item should be selected!\n")); 784 786 785 m_pMachineCloseMenuAction->setEnabled(isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, pItem ));787 m_pMachineCloseMenuAction->setEnabled(isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, pItem, items)); 786 788 } 787 789 … … 790 792 /* Get current item: */ 791 793 UIVMItem *pItem = m_pVMListView->currentItem(); 794 /* Get selected items: */ 795 QList<UIVMItem*> items = m_pVMListView->currentItems(); 792 796 AssertMsgReturnVoid(pItem, ("Current item should be selected!\n")); 793 797 794 m_pACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, pItem ));798 m_pACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, pItem, items)); 795 799 } 796 800 … … 849 853 850 854 /* Enable/disable actions: */ 851 m_pSettingsDialogAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_SettingsDialog, pItem ));852 m_pCloneWizardAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_CloneWizard, pItem ));853 m_pRemoveDialogAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_RemoveDialog, pItem ));854 m_pStartOrShowAction->setEnabled(isActionEnabled(UIActionIndexSelector_State_Machine_StartOrShow, pItem ));855 m_pDiscardAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Discard, pItem ));856 m_pPauseAndResumeAction->setEnabled(isActionEnabled(UIActionIndexSelector_Toggle_Machine_PauseAndResume, pItem ));857 m_pResetAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Reset, pItem ));858 m_pACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, pItem ));859 m_pPowerOffAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_PowerOff, pItem ));860 m_pRefreshAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Refresh, pItem ));861 m_pLogDialogAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_LogDialog, pItem ));862 m_pShowInFileManagerAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_ShowInFileManager, pItem ));863 m_pCreateShortcutAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_CreateShortcut, pItem ));864 m_pSortAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Sort, pItem ));855 m_pSettingsDialogAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_SettingsDialog, pItem, items)); 856 m_pCloneWizardAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_CloneWizard, pItem, items)); 857 m_pRemoveDialogAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_RemoveDialog, pItem, items)); 858 m_pStartOrShowAction->setEnabled(isActionEnabled(UIActionIndexSelector_State_Machine_StartOrShow, pItem, items)); 859 m_pDiscardAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Discard, pItem, items)); 860 m_pPauseAndResumeAction->setEnabled(isActionEnabled(UIActionIndexSelector_Toggle_Machine_PauseAndResume, pItem, items)); 861 m_pResetAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Reset, pItem, items)); 862 m_pACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, pItem, items)); 863 m_pPowerOffAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_PowerOff, pItem, items)); 864 m_pRefreshAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Refresh, pItem, items)); 865 m_pLogDialogAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_LogDialog, pItem, items)); 866 m_pShowInFileManagerAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_ShowInFileManager, pItem, items)); 867 m_pCreateShortcutAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_CreateShortcut, pItem, items)); 868 m_pSortAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Sort, pItem, items)); 865 869 866 870 /* If currently selected VM item is accessible: */ … … 1800 1804 } 1801 1805 1802 bool UISelectorWindow::isActionEnabled(int iActionIndex, UIVMItem *pItem )1806 bool UISelectorWindow::isActionEnabled(int iActionIndex, UIVMItem *pItem, const QList<UIVMItem*> &items) 1803 1807 { 1804 1808 switch (iActionIndex) … … 1806 1810 case UIActionIndexSelector_Simple_Machine_SettingsDialog: 1807 1811 { 1808 /* Check that item is present andaccessible1812 /* Check that there is only one item, its accessible 1809 1813 * and machine is not in 'stuck' or 'saved' state. 1810 1814 * Modifying VM settings in 'saved' state will be available later. */ 1811 return pItem && pItem->accessible() && 1815 return items.size() == 1 && 1816 pItem && pItem->accessible() && 1812 1817 pItem->machineState() != KMachineState_Stuck && 1813 1818 pItem->machineState() != KMachineState_Saved; … … 1815 1820 case UIActionIndexSelector_Simple_Machine_CloneWizard: 1816 1821 { 1817 /* Check that item is present andaccessible1822 /* Check that there is only one item, its accessible 1818 1823 * and session state is unlocked. */ 1819 return pItem && pItem->accessible() && 1824 return items.size() == 1 && 1825 pItem && pItem->accessible() && 1820 1826 pItem->sessionState() == KSessionState_Unlocked; 1821 1827 } … … 1847 1853 case UIActionIndexSelector_Simple_Machine_Discard: 1848 1854 { 1849 /* Check that item present andaccessible1855 /* Check that there is only one item, its accessible 1850 1856 * and machine is in 'saved' state and session state is unlocked. */ 1851 return pItem && pItem->accessible() && 1857 return items.size() == 1 && 1858 pItem && pItem->accessible() && 1852 1859 pItem->machineState() == KMachineState_Saved && 1853 1860 pItem->sessionState() == KSessionState_Unlocked; … … 1884 1891 { 1885 1892 /* Check that 'Machine/Close' menu is enabled: */ 1886 if (!isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, pItem ))1893 if (!isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, pItem, items)) 1887 1894 return false; 1888 1895 … … 1906 1913 { 1907 1914 /* The same as 'Machine/Close' menu is enabled: */ 1908 return isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, pItem );1915 return isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, pItem, items); 1909 1916 } 1910 1917 case UIActionIndexSelector_Simple_Machine_Refresh: -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r39326 r39601 158 158 159 159 /* Static helping stuff: */ 160 static bool isActionEnabled(int iActionIndex, UIVMItem *pItem );160 static bool isActionEnabled(int iActionIndex, UIVMItem *pItem, const QList<UIVMItem*> &items); 161 161 162 162 /* Central splitter window: */
Note:
See TracChangeset
for help on using the changeset viewer.