VirtualBox

Changeset 89515 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jun 4, 2021 6:39:07 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: Adjusting r144088 and r144082 to work on systems where menu-bar got initied on startup, like on Ubuntu 16.04.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r89248 r89515  
    706706    // These menus are dynamical since local and cloud VMs have different menu contents.
    707707    // Yet .. we have to prepare Machine/Group menus beforehand, they contains shortcuts.
    708     if (currentItem())
    709     {
    710         updateMenuGroup(actionPool()->action(UIActionIndexMN_M_Group)->menu());
    711         updateMenuMachine(actionPool()->action(UIActionIndexMN_M_Machine)->menu());
    712     }
     708    updateMenuGroup(actionPool()->action(UIActionIndexMN_M_Group)->menu());
     709    updateMenuMachine(actionPool()->action(UIActionIndexMN_M_Machine)->menu());
    713710
    714711    updateActionsVisibility();
     
    25782575}
    25792576
     2577bool UIVirtualBoxManager::isSingleCloudProviderGroupSelected() const
     2578{
     2579    return m_pWidget->isSingleCloudProviderGroupSelected();
     2580}
     2581
    25802582bool UIVirtualBoxManager::isSingleCloudProfileGroupSelected() const
    25812583{
     
    28192821void UIVirtualBoxManager::updateMenuGroup(QMenu *pMenu)
    28202822{
    2821     /* For single local group selected: */
    2822     if (isSingleLocalGroupSelected())
     2823    /* For single cloud provider/profile: */
     2824    if (   isSingleCloudProviderGroupSelected()
     2825        || isSingleCloudProfileGroupSelected())
     2826    {
     2827        /* Populate Group-menu: */
     2828        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_New));
     2829        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Add));
     2830        pMenu->addSeparator();
     2831        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_StartOrShow));
     2832        pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Console)->menu());
     2833        pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Close)->menu());
     2834        pMenu->addSeparator();
     2835        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Refresh));
     2836        pMenu->addSeparator();
     2837        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Sort));
     2838        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_T_Search));
     2839    }
     2840    /* For other cases, like local group or no group at all: */
     2841    else
    28232842    {
    28242843        /* Populate Group-menu: */
     
    28472866        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_T_Search));
    28482867    }
    2849     else
    2850     {
    2851         /* Populate Group-menu: */
    2852         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_New));
    2853         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Add));
    2854         pMenu->addSeparator();
    2855         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_StartOrShow));
    2856         pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Console)->menu());
    2857         pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Close)->menu());
    2858         pMenu->addSeparator();
    2859         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Refresh));
    2860         pMenu->addSeparator();
    2861         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Sort));
    2862         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_T_Search));
    2863     }
    28642868}
    28652869
     
    28682872    /* Get first selected item: */
    28692873    UIVirtualMachineItem *pItem = currentItem();
    2870     AssertPtrReturnVoid(pItem);
    2871 
    2872     /* For local machine: */
    2873     if (pItem->itemType() == UIVirtualMachineItemType_Local)
     2874
     2875    /* For cloud machine(s): */
     2876    if (   pItem
     2877        && (   pItem->itemType() == UIVirtualMachineItemType_CloudFake
     2878            || pItem->itemType() == UIVirtualMachineItemType_CloudReal))
     2879    {
     2880        /* Populate Machine-menu: */
     2881        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_New));
     2882        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Add));
     2883        pMenu->addSeparator();
     2884        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
     2885        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Remove));
     2886        pMenu->addSeparator();
     2887        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
     2888        pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Console)->menu());
     2889        pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Close)->menu());
     2890        pMenu->addSeparator();
     2891        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Refresh));
     2892        pMenu->addSeparator();
     2893        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_SortParent));
     2894        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_T_Search));
     2895    }
     2896    /* For other cases, like local machine(s) or no machine at all: */
     2897    else
    28742898    {
    28752899        /* Populate Machine-menu: */
     
    28972921        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_ShowInFileManager));
    28982922        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_CreateShortcut));
    2899         pMenu->addSeparator();
    2900         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_SortParent));
    2901         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_T_Search));
    2902     }
    2903     else
    2904     {
    2905         /* Populate Machine-menu: */
    2906         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_New));
    2907         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Add));
    2908         pMenu->addSeparator();
    2909         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
    2910         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Remove));
    2911         pMenu->addSeparator();
    2912         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_StartOrShow));
    2913         pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Console)->menu());
    2914         pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Close)->menu());
    2915         pMenu->addSeparator();
    2916         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Refresh));
    29172923        pMenu->addSeparator();
    29182924        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_SortParent));
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h

    r88519 r89515  
    346346        /** Returns whether single local group is selected. */
    347347        bool isSingleLocalGroupSelected() const;
     348        /** Returns whether single cloud provider group is selected. */
     349        bool isSingleCloudProviderGroupSelected() const;
    348350        /** Returns whether single cloud profile group is selected. */
    349351        bool isSingleCloudProfileGroupSelected() const;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette