VirtualBox

Changeset 52589 in vbox for trunk/src


Ignore:
Timestamp:
Sep 3, 2014 4:04:29 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
95861
Message:

FE/Qt: Action-pool: Unified way of adding/removing, showing/hiding, enabling/disabling menu-bar menus and actions.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp

    r52583 r52589  
    329329    /** Returns action extra-data key. */
    330330    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Application); }
     331    /** Returns whether action is allowed. */
     332    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Application); }
    331333
    332334    void retranslateUi()
     
    354356    /** Returns action extra-data key. */
    355357    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuApplicationActionType_Close); }
     358    /** Returns whether action is allowed. */
     359    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_Close); }
    356360
    357361    QString shortcutExtraDataID() const
     
    391395    /** Returns action extra-data key. */
    392396    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Help); }
     397    /** Returns whether action is allowed. */
     398    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Help); }
    393399
    394400    void retranslateUi()
     
    416422    /** Returns action extra-data key. */
    417423    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_Contents); }
     424    /** Returns whether action is allowed. */
     425    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_Contents); }
    418426
    419427    QString shortcutExtraDataID() const
     
    457465    /** Returns action extra-data key. */
    458466    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_WebSite); }
     467    /** Returns whether action is allowed. */
     468    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_WebSite); }
    459469
    460470    QString shortcutExtraDataID() const
     
    488498    /** Returns action extra-data key. */
    489499    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_ResetWarnings); }
     500    /** Returns whether action is allowed. */
     501    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_ResetWarnings); }
    490502
    491503    QString shortcutExtraDataID() const
     
    520532    /** Returns action extra-data key. */
    521533    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_NetworkAccessManager); }
     534    /** Returns whether action is allowed. */
     535    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_NetworkAccessManager); }
    522536
    523537    QString shortcutExtraDataID() const
     
    552566    /** Returns action extra-data key. */
    553567    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_CheckForUpdates); }
     568    /** Returns whether action is allowed. */
     569    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_CheckForUpdates); }
    554570
    555571    QString shortcutExtraDataID() const
     
    599615#endif /* !Q_WS_MAC */
    600616    }
     617    /** Returns whether action is allowed. */
     618    virtual bool isAllowed() const
     619    {
     620#ifdef Q_WS_MAC
     621        return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_About);
     622#else /* !Q_WS_MAC */
     623        return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_About);
     624#endif /* !Q_WS_MAC */
     625    }
    601626
    602627    QString shortcutExtraDataID() const
     
    643668#else /* !Q_WS_MAC */
    644669        return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_Preferences);
     670#endif /* !Q_WS_MAC */
     671    }
     672    /** Returns whether action is allowed. */
     673    virtual bool isAllowed() const
     674    {
     675#ifdef Q_WS_MAC
     676        return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_Preferences);
     677#else /* !Q_WS_MAC */
     678        return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_Preferences);
    645679#endif /* !Q_WS_MAC */
    646680    }
     
    945979
    946980    /* 'About' action: */
    947     const bool fAllowToShowActionAbout = isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_About);
    948     action(UIActionIndex_M_Application_S_About)->setEnabled(fAllowToShowActionAbout);
    949     action(UIActionIndex_M_Application_S_About)->setVisible(fAllowToShowActionAbout);
    950     if (!pMenu->isConsumed())
    951         pMenu->addAction(action(UIActionIndex_M_Application_S_About));
    952 
    953     /* Only for Runtime pool: */
     981    addAction(pMenu, action(UIActionIndex_M_Application_S_About));
     982    /* 'Preferences' action (only for Runtime pool): */
    954983    if (type() == UIActionPoolType_Runtime)
    955     {
    956         /* 'Preferences' action: */
    957         const bool fAllowToShowActionPreferences = isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_Preferences);
    958         action(UIActionIndex_M_Application_S_Preferences)->setEnabled(fAllowToShowActionPreferences);
    959         action(UIActionIndex_M_Application_S_Preferences)->setVisible(fAllowToShowActionPreferences);
    960         if (!pMenu->isConsumed())
    961             pMenu->addAction(action(UIActionIndex_M_Application_S_Preferences));
    962     }
    963 
    964     /* Close action: */
    965     const bool fAllowToShowActionClose = isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_Close);
    966     action(UIActionIndex_M_Application_S_Close)->setEnabled(fAllowToShowActionClose);
    967     if (!pMenu->isConsumed())
    968         pMenu->addAction(action(UIActionIndex_M_Application_S_Close));
     984        addAction(pMenu, action(UIActionIndex_M_Application_S_Preferences));
     985    /* 'Close' action: */
     986    addAction(pMenu, action(UIActionIndex_M_Application_S_Close));
    969987
    970988    /* Mark menu as valid: */
     
    976994{
    977995    /* Get corresponding menu: */
    978     QMenu *pMenu = action(UIActionIndex_Menu_Help)->menu();
     996    UIMenu *pMenu = action(UIActionIndex_Menu_Help)->menu();
    979997    AssertPtrReturnVoid(pMenu);
    980998    /* Clear contents: */
    981999    pMenu->clear();
    9821000
    983 
    9841001    /* Separator? */
    9851002    bool fSeparator = false;
    9861003
    987 
    9881004    /* 'Contents' action: */
    989     const bool fAllowToShowActionContents = isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_Contents);
    990     action(UIActionIndex_Simple_Contents)->setEnabled(fAllowToShowActionContents);
    991     if (fAllowToShowActionContents)
    992     {
    993         pMenu->addAction(action(UIActionIndex_Simple_Contents));
    994         fSeparator = true;
    995     }
    996 
     1005    fSeparator = addAction(pMenu, action(UIActionIndex_Simple_Contents));
    9971006    /* 'Web Site' action: */
    998     const bool fAllowToShowActionWebSite = isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_WebSite);
    999     action(UIActionIndex_Simple_WebSite)->setEnabled(fAllowToShowActionWebSite);
    1000     if (fAllowToShowActionWebSite)
    1001     {
    1002         pMenu->addAction(action(UIActionIndex_Simple_WebSite));
    1003         fSeparator = true;
    1004     }
    1005 
     1007    fSeparator = addAction(pMenu, action(UIActionIndex_Simple_WebSite));
    10061008
    10071009    /* Separator? */
     
    10121014    }
    10131015
    1014 
    10151016    /* 'Reset Warnings' action: */
    1016     const bool fAllowToShowActionResetWarnings = isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_ResetWarnings);
    1017     action(UIActionIndex_Simple_ResetWarnings)->setEnabled(fAllowToShowActionResetWarnings);
    1018     if (fAllowToShowActionResetWarnings)
    1019     {
    1020         pMenu->addAction(action(UIActionIndex_Simple_ResetWarnings));
    1021         fSeparator = true;
    1022     }
    1023 
     1017    fSeparator = addAction(pMenu, action(UIActionIndex_Simple_ResetWarnings));
    10241018
    10251019    /* Separator? */
     
    10301024    }
    10311025
    1032 
    10331026#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    10341027    /* 'Network Manager' action: */
    1035     const bool fAllowToShowActionNetworkManager = isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_NetworkAccessManager);
    1036     action(UIActionIndex_Simple_NetworkAccessManager)->setEnabled(fAllowToShowActionNetworkManager);
    1037     if (fAllowToShowActionNetworkManager)
    1038     {
    1039         pMenu->addAction(action(UIActionIndex_Simple_NetworkAccessManager));
    1040         fSeparator = true;
    1041     }
    1042 
    1043     /* Only for Selector pool: */
     1028    fSeparator = addAction(pMenu, action(UIActionIndex_Simple_NetworkAccessManager));
     1029    /* 'Check for Updates' action (only for Selector pool): */
    10441030    if (type() == UIActionPoolType_Selector)
    1045     {
    1046         /* 'Check for Updates' action: */
    1047         const bool fAllowToShowActionCheckForUpdates = isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_CheckForUpdates);
    1048         action(UIActionIndex_Simple_NetworkAccessManager)->setEnabled(fAllowToShowActionCheckForUpdates);
    1049         if (fAllowToShowActionCheckForUpdates)
    1050         {
    1051             pMenu->addAction(action(UIActionIndex_Simple_CheckForUpdates));
    1052             fSeparator = true;
    1053         }
    1054     }
    1055 
     1031        fSeparator = addAction(pMenu, action(UIActionIndex_Simple_CheckForUpdates));
    10561032
    10571033    /* Separator? */
     
    10631039#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    10641040
    1065 
    10661041#ifndef RT_OS_DARWIN
    10671042    /* 'About' action: */
    1068     const bool fAllowToShowActionAbout = isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_About);
    1069     action(UIActionIndex_Simple_About)->setEnabled(fAllowToShowActionAbout);
    1070     if (fAllowToShowActionAbout)
    1071         pMenu->addAction(action(UIActionIndex_Simple_About));
    1072 
    1073     /* Only for Runtime pool: */
     1043    fSeparator = addAction(pMenu, action(UIActionIndex_Simple_About));
     1044    /* 'Preferences' action (only for Runtime pool): */
    10741045    if (type() == UIActionPoolType_Runtime)
    1075     {
    1076         /* 'Preferences' action: */
    1077         const bool fAllowToShowActionPreferences = isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_Preferences);
    1078         action(UIActionIndex_Simple_Preferences)->setEnabled(fAllowToShowActionPreferences);
    1079         if (fAllowToShowActionPreferences)
    1080             pMenu->addAction(action(UIActionIndex_Simple_Preferences));
    1081     }
     1046        fSeparator = addAction(pMenu, action(UIActionIndex_Simple_Preferences));
    10821047#endif /* !RT_OS_DARWIN */
    1083 
    10841048
    10851049    /* Mark menu as valid: */
     
    11161080}
    11171081
     1082bool UIActionPool::addAction(UIMenu *pMenu, UIAction *pAction, bool fReallyAdd /* = true */)
     1083{
     1084    /* Check if action is allowed: */
     1085    const bool fIsActionAllowed = pAction->isAllowed();
     1086
     1087#ifdef RT_OS_DARWIN
     1088    /* Check if menu is consumable: */
     1089    const bool fIsMenuConsumable = pMenu->isConsumable();
     1090    /* Check if menu is NOT yet consumed: */
     1091    const bool fIsMenuConsumed = pMenu->isConsumed();
     1092#endif /* RT_OS_DARWIN */
     1093
     1094    /* Make this action enabled/visible
     1095     * depending on clearance state. */
     1096    pAction->setEnabled(fIsActionAllowed);
     1097    pAction->setVisible(fIsActionAllowed);
     1098
     1099#ifdef RT_OS_DARWIN
     1100    /* If menu is consumable: */
     1101    if (fIsMenuConsumable)
     1102    {
     1103        /* Add action only if menu was not yet consumed: */
     1104        if (!fIsMenuConsumed)
     1105            pMenu->addAction(pAction);
     1106    }
     1107    /* If menu is NOT consumable: */
     1108    else
     1109#endif /* RT_OS_DARWIN */
     1110    {
     1111        /* Add action only if is allowed: */
     1112        if (fIsActionAllowed && fReallyAdd)
     1113            pMenu->addAction(pAction);
     1114    }
     1115
     1116    /* Return if action is allowed: */
     1117    return fIsActionAllowed;
     1118}
     1119
     1120bool UIActionPool::addMenu(QList<QMenu*> &menuList, UIAction *pAction, bool fReallyAdd /* = true */)
     1121{
     1122    /* Check if action is allowed: */
     1123    const bool fIsActionAllowed = pAction->isAllowed();
     1124
     1125    /* Get action's menu: */
     1126    UIMenu *pMenu = pAction->menu();
     1127
     1128#ifdef RT_OS_DARWIN
     1129    /* Check if menu is consumable: */
     1130    const bool fIsMenuConsumable = pMenu->isConsumable();
     1131    /* Check if menu is NOT yet consumed: */
     1132    const bool fIsMenuConsumed = pMenu->isConsumed();
     1133#endif /* RT_OS_DARWIN */
     1134
     1135    /* Make this action enabled/visible
     1136     * depending on clearance state. */
     1137    pAction->setEnabled(   fIsActionAllowed
     1138#ifdef RT_OS_DARWIN
     1139                        && !fIsMenuConsumable
     1140#endif /* RT_OS_DARWIN */
     1141                        );
     1142    pAction->setVisible(   fIsActionAllowed
     1143#ifdef RT_OS_DARWIN
     1144                        && !fIsMenuConsumable
     1145#endif /* RT_OS_DARWIN */
     1146                        );
     1147
     1148#ifdef RT_OS_DARWIN
     1149    /* If menu is consumable: */
     1150    if (fIsMenuConsumable)
     1151    {
     1152        /* Add action's menu only if menu was not yet consumed: */
     1153        if (!fIsMenuConsumed)
     1154            menuList << pMenu;
     1155    }
     1156    /* If menu is NOT consumable: */
     1157    else
     1158#endif /* RT_OS_DARWIN */
     1159    {
     1160        /* Add action only if is allowed: */
     1161        if (fIsActionAllowed && fReallyAdd)
     1162            menuList << pMenu;
     1163    }
     1164
     1165    /* Return if action is allowed: */
     1166    return fIsActionAllowed;
     1167}
     1168
    11181169#include "UIActionPool.moc"
    11191170
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h

    r52583 r52589  
    159159    /** Returns action extra-data key. */
    160160    virtual QString extraDataKey() const { return QString(); }
     161    /** Returns whether action is allowed. */
     162    virtual bool isAllowed() const { return true; }
    161163
    162164    /** Returns extra-data ID to save keyboard shortcut under. */
     
    430432    virtual bool event(QEvent *pEvent);
    431433
     434    /** Adds action into corresponding menu. */
     435    bool addAction(UIMenu *pMenu, UIAction *pAction, bool fReallyAdd = true);
     436    /** Adds action's menu into corresponding menu list. */
     437    bool addMenu(QList<QMenu*> &menuList, UIAction *pAction, bool fReallyAdd = true);
     438
    432439    /** Holds the action-pool type. */
    433440    const UIActionPoolType m_type;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp

    r52583 r52589  
    4949    /** Returns action extra-data key. */
    5050    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Machine); }
     51    /** Returns whether action is allowed. */
     52    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Machine); }
    5153
    5254    void retranslateUi()
     
    7173    /** Returns action extra-data key. */
    7274    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog); }
     75    /** Returns whether action is allowed. */
     76    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog); }
    7377
    7478    QString shortcutExtraDataID() const
     
    104108    /** Returns action extra-data key. */
    105109    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot); }
     110    /** Returns whether action is allowed. */
     111    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot); }
    106112
    107113    QString shortcutExtraDataID() const
     
    137143    /** Returns action extra-data key. */
    138144    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeScreenshot); }
     145    /** Returns whether action is allowed. */
     146    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeScreenshot); }
    139147
    140148    QString shortcutExtraDataID() const
     
    170178    /** Returns action extra-data key. */
    171179    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_InformationDialog); }
     180    /** Returns whether action is allowed. */
     181    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_InformationDialog); }
    172182
    173183    QString shortcutExtraDataID() const
     
    203213    /** Returns action extra-data key. */
    204214    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Keyboard); }
     215    /** Returns whether action is allowed. */
     216    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Keyboard); }
    205217
    206218    void retranslateUi()
     
    225237    /** Returns action extra-data key. */
    226238    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_KeyboardSettings); }
     239    /** Returns whether action is allowed. */
     240    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_KeyboardSettings); }
    227241
    228242    QString shortcutExtraDataID() const
     
    253267    /** Returns action extra-data key. */
    254268    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Mouse); }
     269    /** Returns whether action is allowed. */
     270    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Mouse); }
    255271
    256272    void retranslateUi()
     
    277293    /** Returns action extra-data key. */
    278294    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_MouseIntegration); }
     295    /** Returns whether action is allowed. */
     296    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_MouseIntegration); }
    279297
    280298    QString shortcutExtraDataID() const
     
    310328    /** Returns action extra-data key. */
    311329    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TypeCAD); }
     330    /** Returns whether action is allowed. */
     331    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TypeCAD); }
    312332
    313333    QString shortcutExtraDataID() const
     
    344364    /** Returns action extra-data key. */
    345365    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TypeCABS); }
     366    /** Returns whether action is allowed. */
     367    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TypeCABS); }
    346368
    347369    QString shortcutExtraDataID() const
     
    380402    /** Returns action extra-data key. */
    381403    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause); }
     404    /** Returns whether action is allowed. */
     405    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause); }
    382406
    383407    QString shortcutExtraDataID() const
     
    413437    /** Returns action extra-data key. */
    414438    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Reset); }
     439    /** Returns whether action is allowed. */
     440    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Reset); }
    415441
    416442    QString shortcutExtraDataID() const
     
    446472    /** Returns action extra-data key. */
    447473    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState); }
     474    /** Returns whether action is allowed. */
     475    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState); }
    448476
    449477    QString shortcutExtraDataID() const
     
    474502    /** Returns action extra-data key. */
    475503    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Shutdown); }
     504    /** Returns whether action is allowed. */
     505    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Shutdown); }
    476506
    477507    QString shortcutExtraDataID() const
     
    511541    /** Returns action extra-data key. */
    512542    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_PowerOff); }
     543    /** Returns whether action is allowed. */
     544    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_PowerOff); }
    513545
    514546    QString shortcutExtraDataID() const
     
    543575    /** Returns action extra-data key. */
    544576    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Close);}
     577    /** Returns whether action is allowed. */
     578    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Close); }
    545579
    546580    QString shortcutExtraDataID() const
     
    577611    /** Returns action extra-data key. */
    578612    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_View); }
     613    /** Returns whether action is allowed. */
     614    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_View); }
    579615
    580616    void retranslateUi()
     
    599635    /** Returns action extra-data key. */
    600636    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_View); }
     637    /** Returns whether action is allowed. */
     638    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_View); }
    601639
    602640    void retranslateUi() {}
     
    620658    /** Returns action extra-data key. */
    621659    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Fullscreen); }
     660    /** Returns whether action is allowed. */
     661    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Fullscreen); }
    622662
    623663    QString shortcutExtraDataID() const
     
    655695    /** Returns action extra-data key. */
    656696    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Seamless); }
     697    /** Returns whether action is allowed. */
     698    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Seamless); }
    657699
    658700    QString shortcutExtraDataID() const
     
    690732    /** Returns action extra-data key. */
    691733    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Scale); }
     734    /** Returns whether action is allowed. */
     735    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Scale); }
    692736
    693737    QString shortcutExtraDataID() const
     
    725769    /** Returns action extra-data key. */
    726770    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize); }
     771    /** Returns whether action is allowed. */
     772    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize); }
    727773
    728774    QString shortcutExtraDataID() const
     
    758804    /** Returns action extra-data key. */
    759805    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow); }
     806    /** Returns whether action is allowed. */
     807    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow); }
    760808
    761809    QString shortcutExtraDataID() const
     
    791839    /** Returns action extra-data key. */
    792840    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar); }
     841    /** Returns whether action is allowed. */
     842    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar); }
    793843
    794844    void retranslateUi()
     
    813863    /** Returns action extra-data key. */
    814864    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings); }
     865    /** Returns whether action is allowed. */
     866    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings); }
    815867
    816868    QString shortcutExtraDataID() const
     
    841893    /** Returns action extra-data key. */
    842894    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar); }
     895    /** Returns whether action is allowed. */
     896    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar); }
    843897
    844898    void retranslateUi()
     
    863917    /** Returns action extra-data key. */
    864918    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings); }
     919    /** Returns whether action is allowed. */
     920    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings); }
    865921
    866922    QString shortcutExtraDataID() const
     
    892948    /** Returns action extra-data key. */
    893949    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar); }
     950    /** Returns whether action is allowed. */
     951    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar); }
    894952
    895953    QString shortcutExtraDataID() const
     
    920978    /** Returns action extra-data key. */
    921979    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Devices); }
     980    /** Returns whether action is allowed. */
     981    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Devices); }
    922982
    923983    void retranslateUi()
     
    9451005    /** Returns action extra-data key. */
    9461006    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrives); }
     1007    /** Returns whether action is allowed. */
     1008    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrives); }
    9471009
    9481010    void retranslateUi()
     
    9671029    /** Returns action extra-data key. */
    9681030    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrivesSettings); }
     1031    /** Returns whether action is allowed. */
     1032    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrivesSettings); }
    9691033
    9701034    QString shortcutExtraDataID() const
     
    9981062    /** Returns action extra-data key. */
    9991063    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices); }
     1064    /** Returns whether action is allowed. */
     1065    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices); }
    10001066
    10011067    void retranslateUi()
     
    10231089    /** Returns action extra-data key. */
    10241090    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices); }
     1091    /** Returns whether action is allowed. */
     1092    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices); }
    10251093
    10261094    void retranslateUi()
     
    10451113    /** Returns action extra-data key. */
    10461114    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network); }
     1115    /** Returns whether action is allowed. */
     1116    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network); }
    10471117
    10481118    void retranslateUi()
     
    10671137    /** Returns action extra-data key. */
    10681138    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings); }
     1139    /** Returns whether action is allowed. */
     1140    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings); }
    10691141
    10701142    QString shortcutExtraDataID() const
     
    10981170    /** Returns action extra-data key. */
    10991171    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices); }
     1172    /** Returns whether action is allowed. */
     1173    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices); }
    11001174
    11011175    void retranslateUi()
     
    11201194    /** Returns action extra-data key. */
    11211195    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevicesSettings); }
     1196    /** Returns whether action is allowed. */
     1197    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevicesSettings); }
    11221198
    11231199    QString shortcutExtraDataID() const
     
    11511227    /** Returns action extra-data key. */
    11521228    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams); }
     1229    /** Returns whether action is allowed. */
     1230    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams); }
    11531231
    11541232    void retranslateUi()
     
    11731251    /** Returns action extra-data key. */
    11741252    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedClipboard); }
     1253    /** Returns whether action is allowed. */
     1254    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedClipboard); }
    11751255
    11761256    void retranslateUi()
     
    11951275    /** Returns action extra-data key. */
    11961276    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_DragAndDrop); }
     1277    /** Returns whether action is allowed. */
     1278    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_DragAndDrop); }
    11971279
    11981280    void retranslateUi()
     
    12171299    /** Returns action extra-data key. */
    12181300    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders); }
     1301    /** Returns whether action is allowed. */
     1302    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders); }
    12191303
    12201304    void retranslateUi()
     
    12391323    /** Returns action extra-data key. */
    12401324    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings); }
     1325    /** Returns whether action is allowed. */
     1326    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings); }
    12411327
    12421328    QString shortcutExtraDataID() const
     
    12691355    /** Returns action extra-data key. */
    12701356    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VRDEServer); }
     1357    /** Returns whether action is allowed. */
     1358    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VRDEServer); }
    12711359
    12721360    QString shortcutExtraDataID() const
     
    12971385    /** Returns action extra-data key. */
    12981386    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VideoCapture); }
     1387    /** Returns whether action is allowed. */
     1388    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VideoCapture); }
    12991389
    13001390    void retranslateUi()
     
    13211411    /** Returns action extra-data key. */
    13221412    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_StartVideoCapture); }
     1413    /** Returns whether action is allowed. */
     1414    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_StartVideoCapture); }
    13231415
    13241416    QString shortcutExtraDataID() const
     
    13491441    /** Returns action extra-data key. */
    13501442    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VideoCaptureSettings); }
     1443    /** Returns whether action is allowed. */
     1444    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VideoCaptureSettings); }
    13511445
    13521446    QString shortcutExtraDataID() const
     
    13771471    /** Returns action extra-data key. */
    13781472    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InstallGuestTools); }
     1473    /** Returns whether action is allowed. */
     1474    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InstallGuestTools); }
    13791475
    13801476    QString shortcutExtraDataID() const
     
    14111507    /** Returns action extra-data key. */
    14121508    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Debug); }
     1509    /** Returns whether action is allowed. */
     1510    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Debug); }
    14131511
    14141512    void retranslateUi()
     
    14331531    /** Returns action extra-data key. */
    14341532    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics); }
     1533    /** Returns whether action is allowed. */
     1534    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics); }
    14351535
    14361536    QString shortcutExtraDataID() const
     
    14601560    /** Returns action extra-data key. */
    14611561    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine); }
     1562    /** Returns whether action is allowed. */
     1563    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine); }
    14621564
    14631565    QString shortcutExtraDataID() const
     
    14871589    /** Returns action extra-data key. */
    14881590    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging); }
     1591    /** Returns whether action is allowed. */
     1592    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging); }
    14891593
    14901594    QString shortcutExtraDataID() const
     
    15141618    /** Returns action extra-data key. */
    15151619    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_LogDialog); }
     1620    /** Returns whether action is allowed. */
     1621    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_LogDialog); }
    15161622
    15171623    QString shortcutExtraDataID() const
     
    19892095#ifdef RT_OS_DARWIN
    19902096    /* 'Application' menu: */
    1991     action(UIActionIndex_M_Application)->setVisible(false);
    1992     m_mainMenus << action(UIActionIndex_M_Application)->menu();
     2097    addMenu(m_mainMenus, action(UIActionIndex_M_Application));
    19932098    updateMenuApplication();
    19942099#endif /* RT_OS_DARWIN */
    19952100
    19962101    /* 'Machine' menu: */
    1997     const bool fAllowToShowMenuMachine = isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Machine);
    1998     action(UIActionIndexRT_M_Machine)->setVisible(fAllowToShowMenuMachine);
    1999     if (fAllowToShowMenuMachine)
    2000         m_mainMenus << action(UIActionIndexRT_M_Machine)->menu();
     2102    addMenu(m_mainMenus, action(UIActionIndexRT_M_Machine));
    20012103    updateMenuMachine();
    20022104
    20032105    /* 'View' menu: */
    2004     const bool fAllowToShowMenuView = isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_View);
    2005     action(UIActionIndexRT_M_View)->setVisible(fAllowToShowMenuView);
    2006     action(UIActionIndexRT_M_ViewPopup)->setVisible(fAllowToShowMenuView);
    2007     if (fAllowToShowMenuView)
    2008         m_mainMenus << action(UIActionIndexRT_M_View)->menu();
     2106    addMenu(m_mainMenus, action(UIActionIndexRT_M_View));
    20092107    updateMenuView();
     2108    /* 'View' popup menu: */
     2109    addMenu(m_mainMenus, action(UIActionIndexRT_M_ViewPopup), false);
    20102110    updateMenuViewPopup();
    20112111
    20122112    /* 'Devices' menu: */
    2013     const bool fAllowToShowMenuDevices = isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Devices);
    2014     action(UIActionIndexRT_M_Devices)->setVisible(fAllowToShowMenuDevices);
    2015     if (fAllowToShowMenuDevices)
    2016         m_mainMenus << action(UIActionIndexRT_M_Devices)->menu();
     2113    addMenu(m_mainMenus, action(UIActionIndexRT_M_Devices));
    20172114    updateMenuDevices();
    20182115
    20192116#ifdef VBOX_WITH_DEBUGGER_GUI
    20202117    /* 'Debug' menu: */
    2021     const bool fAllowToShowMenuDebug = isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Debug);
    2022     action(UIActionIndexRT_M_Debug)->setVisible(fAllowToShowMenuDebug);
    2023     if (fAllowToShowMenuDebug)
    2024         m_mainMenus << action(UIActionIndexRT_M_Debug)->menu();
     2118    addMenu(m_mainMenus, action(UIActionIndexRT_M_Debug));
    20252119    updateMenuDebug();
    20262120#endif /* VBOX_WITH_DEBUGGER_GUI */
    20272121
    20282122    /* 'Help' menu: */
    2029     const bool fAllowToShowMenuHelp = isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Help);
    2030     action(UIActionIndex_Menu_Help)->setVisible(fAllowToShowMenuHelp);
    2031     if (fAllowToShowMenuHelp)
    2032         m_mainMenus << action(UIActionIndex_Menu_Help)->menu();
     2123    addMenu(m_mainMenus, action(UIActionIndex_Menu_Help));
    20332124    updateMenuHelp();
    20342125}
     
    20372128{
    20382129    /* Get corresponding menu: */
    2039     QMenu *pMenu = action(UIActionIndexRT_M_Machine)->menu();
     2130    UIMenu *pMenu = action(UIActionIndexRT_M_Machine)->menu();
    20402131    AssertPtrReturnVoid(pMenu);
    20412132    /* Clear contents: */
    20422133    pMenu->clear();
    20432134
    2044 
    20452135    /* Separator: */
    20462136    bool fSeparator = false;
    20472137
    2048 
    20492138    /* 'Settings Dialog' action: */
    2050     const bool fAllowToShowActionSettingsDialog = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog);
    2051     action(UIActionIndexRT_M_Machine_S_Settings)->setEnabled(fAllowToShowActionSettingsDialog);
    2052     if (fAllowToShowActionSettingsDialog)
    2053     {
    2054         pMenu->addAction(action(UIActionIndexRT_M_Machine_S_Settings));
    2055         fSeparator = true;
    2056     }
    2057 
     2139    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Settings)) || fSeparator;
    20582140    /* 'Take Snapshot' action: */
    2059     const bool fAllowToShowActionTakeSnapshot = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot);
    2060     action(UIActionIndexRT_M_Machine_S_TakeSnapshot)->setEnabled(fAllowToShowActionTakeSnapshot);
    2061     if (fAllowToShowActionTakeSnapshot)
    2062     {
    2063         pMenu->addAction(action(UIActionIndexRT_M_Machine_S_TakeSnapshot));
    2064         fSeparator = true;
    2065     }
    2066 
     2141    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_TakeSnapshot)) || fSeparator;
    20672142    /* 'Take Screenshot' action: */
    2068     const bool fAllowToShowActionTakeScreenshot = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeScreenshot);
    2069     action(UIActionIndexRT_M_Machine_S_TakeScreenshot)->setEnabled(fAllowToShowActionTakeScreenshot);
    2070     if (fAllowToShowActionTakeScreenshot)
    2071     {
    2072         pMenu->addAction(action(UIActionIndexRT_M_Machine_S_TakeScreenshot));
    2073         fSeparator = true;
    2074     }
    2075 
     2143    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_TakeScreenshot)) || fSeparator;
    20762144    /* 'Information Dialog' action: */
    2077     const bool fAllowToShowActionInformationDialog = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_InformationDialog);
    2078     action(UIActionIndexRT_M_Machine_S_ShowInformation)->setEnabled(fAllowToShowActionInformationDialog);
    2079     if (fAllowToShowActionInformationDialog)
    2080     {
    2081         pMenu->addAction(action(UIActionIndexRT_M_Machine_S_ShowInformation));
    2082         fSeparator = true;
    2083     }
    2084 
     2145    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_ShowInformation)) || fSeparator;
    20852146
    20862147    /* Separator: */
     
    20912152    }
    20922153
    2093 
    20942154    /* 'Keyboard' submenu: */
    2095     const bool fAllowToShowActionKeyboard = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Keyboard);
    2096     action(UIActionIndexRT_M_Machine_M_Keyboard)->setEnabled(fAllowToShowActionKeyboard);
    2097     if (fAllowToShowActionKeyboard)
    2098     {
    2099 //        pMenu->addAction(action(UIActionIndexRT_M_Machine_M_Keyboard));
    2100 //        fSeparator = true;
    2101     }
     2155    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_M_Keyboard), false) || fSeparator;
    21022156    updateMenuMachineKeyboard();
    2103 
    21042157    /* 'Keyboard Settings' action: */
    2105     const bool fAllowToShowActionKeyboardSettings = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_KeyboardSettings);
    2106     action(UIActionIndexRT_M_Machine_M_Keyboard_S_Settings)->setEnabled(fAllowToShowActionKeyboardSettings);
    2107     if (fAllowToShowActionKeyboardSettings)
    2108     {
    2109         pMenu->addAction(action(UIActionIndexRT_M_Machine_M_Keyboard_S_Settings));
    2110         fSeparator = true;
    2111     }
    2112 
     2158    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_M_Keyboard_S_Settings)) || fSeparator;
    21132159    /* 'Mouse' submenu: */
    2114     const bool fAllowToShowActionMouse = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Mouse);
    2115     action(UIActionIndexRT_M_Machine_M_Mouse)->setEnabled(fAllowToShowActionMouse);
    2116     if (fAllowToShowActionMouse)
    2117     {
    2118 //        pMenu->addAction(action(UIActionIndexRT_M_Machine_M_Mouse));
    2119 //        fSeparator = true;
    2120     }
     2160    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_M_Mouse), false) || fSeparator;
    21212161    updateMenuMachineMouse();
    2122 
    21232162    /* 'Mouse Integration' action: */
    2124     const bool fAllowToShowActionMouseIntegration = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_MouseIntegration);
    2125     action(UIActionIndexRT_M_Machine_M_Mouse_T_Integration)->setEnabled(fAllowToShowActionMouseIntegration);
    2126     if (fAllowToShowActionMouseIntegration)
    2127     {
    2128         pMenu->addAction(action(UIActionIndexRT_M_Machine_M_Mouse_T_Integration));
    2129         fSeparator = true;
    2130     }
    2131 
     2163    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_M_Mouse_T_Integration)) || fSeparator;
    21322164
    21332165    /* Separator: */
     
    21382170    }
    21392171
    2140 
    21412172    /* 'Type CAD' action: */
    2142     const bool fAllowToShowActionTypeCAD = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TypeCAD);
    2143     action(UIActionIndexRT_M_Machine_S_TypeCAD)->setEnabled(fAllowToShowActionTypeCAD);
    2144     if (fAllowToShowActionTypeCAD)
    2145     {
    2146         pMenu->addAction(action(UIActionIndexRT_M_Machine_S_TypeCAD));
    2147         fSeparator = true;
    2148     }
    2149 
     2173    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_TypeCAD)) || fSeparator;
    21502174#ifdef Q_WS_X11
    21512175    /* 'Type CABS' action: */
    2152     const bool fAllowToShowActionTypeCABS = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TypeCABS);
    2153     action(UIActionIndexRT_M_Machine_S_TypeCABS)->setEnabled(fAllowToShowActionTypeCABS);
    2154     if (fAllowToShowActionTypeCABS)
    2155     {
    2156         pMenu->addAction(action(UIActionIndexRT_M_Machine_S_TypeCABS));
    2157         fSeparator = true;
    2158     }
     2176    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_TypeCABS)) || fSeparator;
    21592177#endif /* Q_WS_X11 */
    2160 
    21612178
    21622179    /* Separator: */
     
    21672184    }
    21682185
    2169 
    21702186    /* 'Pause' action: */
    2171     const bool fAllowToShowActionPause = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause);
    2172     action(UIActionIndexRT_M_Machine_T_Pause)->setEnabled(fAllowToShowActionPause);
    2173     if (fAllowToShowActionPause)
    2174     {
    2175         pMenu->addAction(action(UIActionIndexRT_M_Machine_T_Pause));
    2176         fSeparator = true;
    2177     }
    2178 
     2187    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_T_Pause)) || fSeparator;
    21792188    /* 'Reset' action: */
    2180     const bool fAllowToShowActionReset = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Reset);
    2181     action(UIActionIndexRT_M_Machine_S_Reset)->setEnabled(fAllowToShowActionReset);
    2182     if (fAllowToShowActionReset)
    2183     {
    2184         pMenu->addAction(action(UIActionIndexRT_M_Machine_S_Reset));
    2185         fSeparator = true;
    2186     }
    2187 
     2189    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Reset)) || fSeparator;
    21882190    /* 'Save' action: */
    2189     const bool fAllowToShowActionSaveState = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState);
    2190     action(UIActionIndexRT_M_Machine_S_Save)->setEnabled(fAllowToShowActionSaveState);
    2191     if (fAllowToShowActionSaveState)
    2192     {
    2193         pMenu->addAction(action(UIActionIndexRT_M_Machine_S_Save));
    2194         fSeparator = true;
    2195     }
    2196 
     2191    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Save)) || fSeparator;
    21972192    /* 'Shutdown' action: */
    2198     const bool fAllowToShowActionShutdown = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Shutdown);
    2199     action(UIActionIndexRT_M_Machine_S_Shutdown)->setEnabled(fAllowToShowActionShutdown);
    2200     if (fAllowToShowActionShutdown)
    2201     {
    2202         pMenu->addAction(action(UIActionIndexRT_M_Machine_S_Shutdown));
    2203         fSeparator = true;
    2204     }
    2205 
     2193    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Shutdown)) || fSeparator;
    22062194    /* 'PowerOff' action: */
    2207     const bool fAllowToShowActionPowerOff = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_PowerOff);
    2208     action(UIActionIndexRT_M_Machine_S_PowerOff)->setEnabled(fAllowToShowActionPowerOff);
    2209     if (fAllowToShowActionPowerOff)
    2210     {
    2211         pMenu->addAction(action(UIActionIndexRT_M_Machine_S_PowerOff));
    2212         fSeparator = true;
    2213     }
    2214 
     2195    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_PowerOff)) || fSeparator;
    22152196
    22162197#ifndef Q_WS_MAC
     
    22222203    }
    22232204
    2224 
    2225     /* Close action: */
    2226     const bool fAllowToShowActionClose = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Close);
    2227     pMenu->addAction(action(UIActionIndexRT_M_Machine_S_Close));
    2228     action(UIActionIndexRT_M_Machine_S_Close)->setEnabled(fAllowToShowActionClose);
     2205    /* 'Close' action: */
     2206    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Close)) || fSeparator;
    22292207#endif /* !Q_WS_MAC */
    2230 
    22312208
    22322209    /* Mark menu as valid: */
     
    22372214{
    22382215    /* Get corresponding menu: */
    2239     QMenu *pMenu = action(UIActionIndexRT_M_Machine_M_Keyboard)->menu();
     2216    UIMenu *pMenu = action(UIActionIndexRT_M_Machine_M_Keyboard)->menu();
    22402217    AssertPtrReturnVoid(pMenu);
    22412218    /* Clear contents: */
     
    22432220
    22442221    /* 'Keyboard Settings' action: */
    2245     const bool fAllowToShowActionKeyboardSettings = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_KeyboardSettings);
    2246     action(UIActionIndexRT_M_Machine_M_Keyboard_S_Settings)->setEnabled(fAllowToShowActionKeyboardSettings);
    2247     if (fAllowToShowActionKeyboardSettings)
    2248         pMenu->addAction(action(UIActionIndexRT_M_Machine_M_Keyboard_S_Settings));
     2222    addAction(pMenu, action(UIActionIndexRT_M_Machine_M_Keyboard_S_Settings));
    22492223
    22502224    /* Mark menu as valid: */
     
    22552229{
    22562230    /* Get corresponding menu: */
    2257     QMenu *pMenu = action(UIActionIndexRT_M_Machine_M_Mouse)->menu();
     2231    UIMenu *pMenu = action(UIActionIndexRT_M_Machine_M_Mouse)->menu();
    22582232    AssertPtrReturnVoid(pMenu);
    22592233    /* Clear contents: */
     
    22612235
    22622236    /* 'Machine Integration' action: */
    2263     const bool fAllowToShowActionMouseIntegration = isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_MouseIntegration);
    2264     action(UIActionIndexRT_M_Machine_M_Mouse_T_Integration)->setEnabled(fAllowToShowActionMouseIntegration);
    2265     if (fAllowToShowActionMouseIntegration)
    2266         pMenu->addAction(action(UIActionIndexRT_M_Machine_M_Mouse_T_Integration));
     2237    addAction(pMenu, action(UIActionIndexRT_M_Machine_M_Mouse_T_Integration));
    22672238
    22682239    /* Mark menu as valid: */
     
    22732244{
    22742245    /* Get corresponding menu: */
    2275     QMenu *pMenu = action(UIActionIndexRT_M_View)->menu();
     2246    UIMenu *pMenu = action(UIActionIndexRT_M_View)->menu();
    22762247    AssertPtrReturnVoid(pMenu);
    22772248    /* Clear contents: */
    22782249    pMenu->clear();
    22792250
    2280 
    22812251    /* Separator: */
    22822252    bool fSeparator = false;
    22832253
    2284 
    22852254    /* 'Fullscreen' action: */
    2286     const bool fIsAllowToShowActionFullscreen = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Fullscreen);
    2287     action(UIActionIndexRT_M_View_T_Fullscreen)->setEnabled(fIsAllowToShowActionFullscreen);
    2288     if (fIsAllowToShowActionFullscreen)
    2289     {
    2290         pMenu->addAction(action(UIActionIndexRT_M_View_T_Fullscreen));
    2291         fSeparator = true;
    2292     }
    2293 
     2255    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_Fullscreen)) || fSeparator;
    22942256    /* 'Seamless' action: */
    2295     const bool fIsAllowToShowActionSeamless   = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Seamless);
    2296     action(UIActionIndexRT_M_View_T_Seamless)->setEnabled(fIsAllowToShowActionSeamless);
    2297     if (fIsAllowToShowActionSeamless)
    2298     {
    2299         pMenu->addAction(action(UIActionIndexRT_M_View_T_Seamless));
    2300         fSeparator = true;
    2301     }
    2302 
     2257    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_Seamless)) || fSeparator;
    23032258    /* 'Scale' action: */
    2304     const bool fIsAllowToShowActionScale      = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Scale);
    2305     action(UIActionIndexRT_M_View_T_Scale)->setEnabled(fIsAllowToShowActionScale);
    2306     if (fIsAllowToShowActionScale)
    2307     {
    2308         pMenu->addAction(action(UIActionIndexRT_M_View_T_Scale));
    2309         fSeparator = true;
    2310     }
    2311 
     2259    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_Scale)) || fSeparator;
    23122260
    23132261    /* Separator: */
     
    23182266    }
    23192267
    2320 
    23212268    /* 'Adjust Window' action: */
    2322     const bool fAllowToShowActionAdjustWindow = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow);
    2323     action(UIActionIndexRT_M_View_S_AdjustWindow)->setEnabled(fAllowToShowActionAdjustWindow);
    2324     if (fAllowToShowActionAdjustWindow)
    2325     {
    2326         pMenu->addAction(action(UIActionIndexRT_M_View_S_AdjustWindow));
    2327         fSeparator = true;
    2328     }
    2329 
     2269    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_S_AdjustWindow)) || fSeparator;
    23302270    /* 'Guest Autoresize' action: */
    2331     const bool fAllowToShowActionGuestAutoresize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize);
    2332     action(UIActionIndexRT_M_View_T_GuestAutoresize)->setEnabled(fAllowToShowActionGuestAutoresize);
    2333     if (fAllowToShowActionGuestAutoresize)
    2334     {
    2335         pMenu->addAction(action(UIActionIndexRT_M_View_T_GuestAutoresize));
    2336         fSeparator = true;
    2337     }
    2338 
     2271    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_GuestAutoresize)) || fSeparator;
    23392272
    23402273    /* Separator: */
     
    23452278    }
    23462279
    2347 
    23482280    /* 'Menu Bar' submenu: */
    2349     const bool fAllowToShowActionMenuBar = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar);
    2350     action(UIActionIndexRT_M_View_M_MenuBar)->setEnabled(fAllowToShowActionMenuBar);
    2351     if (fAllowToShowActionMenuBar)
    2352     {
    2353         pMenu->addAction(action(UIActionIndexRT_M_View_M_MenuBar));
    2354         fSeparator = true;
    2355     }
     2281    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_MenuBar)) || fSeparator;
    23562282    updateMenuViewMenuBar();
    2357 
    23582283    /* 'Status Bar' submenu: */
    2359     const bool fAllowToShowActionStatusBar = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar);
    2360     action(UIActionIndexRT_M_View_M_StatusBar)->setEnabled(fAllowToShowActionStatusBar);
    2361     if (fAllowToShowActionStatusBar)
    2362     {
    2363         pMenu->addAction(action(UIActionIndexRT_M_View_M_StatusBar));
    2364         fSeparator = true;
    2365     }
     2284    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_StatusBar)) || fSeparator;
    23662285    updateMenuViewStatusBar();
    2367 
    23682286
    23692287    /* Separator: */
     
    23732291        fSeparator = false;
    23742292    }
    2375 
    23762293
    23772294    /* Do we have to show resize or multiscreen menu? */
     
    24052322    }
    24062323
    2407 
    24082324    /* Mark menu as valid: */
    24092325    m_invalidations.remove(UIActionIndexRT_M_View);
     
    24132329{
    24142330    /* Get corresponding menu: */
    2415     QMenu *pMenu = action(UIActionIndexRT_M_ViewPopup)->menu();
     2331    UIMenu *pMenu = action(UIActionIndexRT_M_ViewPopup)->menu();
    24162332    AssertPtrReturnVoid(pMenu);
    24172333    /* Clear contents: */
    24182334    pMenu->clear();
    24192335
    2420 
    24212336    /* Separator: */
    24222337    bool fSeparator = false;
    24232338
    2424 
    24252339    /* 'Adjust Window' action: */
    2426     const bool fAllowToShowActionAdjustWindow = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow);
    2427     action(UIActionIndexRT_M_View_S_AdjustWindow)->setEnabled(fAllowToShowActionAdjustWindow);
    2428     if (fAllowToShowActionAdjustWindow)
    2429     {
    2430         pMenu->addAction(action(UIActionIndexRT_M_View_S_AdjustWindow));
    2431         fSeparator = true;
    2432     }
    2433 
     2340    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_S_AdjustWindow)) || fSeparator;
    24342341    /* 'Guest Autoresize' action: */
    2435     const bool fAllowToShowActionGuestAutoresize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize);
    2436     action(UIActionIndexRT_M_View_T_GuestAutoresize)->setEnabled(fAllowToShowActionGuestAutoresize);
    2437     if (fAllowToShowActionGuestAutoresize)
    2438     {
    2439         pMenu->addAction(action(UIActionIndexRT_M_View_T_GuestAutoresize));
    2440         fSeparator = true;
    2441     }
    2442 
     2342    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_GuestAutoresize)) || fSeparator;
    24432343
    24442344    /* Separator: */
     
    24482348        fSeparator = false;
    24492349    }
    2450 
    24512350
    24522351    /* Do we have to show resize menu? */
     
    24642363    }
    24652364
    2466 
    24672365    /* Mark menu as valid: */
    24682366    m_invalidations.remove(UIActionIndexRT_M_ViewPopup);
     
    24722370{
    24732371    /* Get corresponding menu: */
    2474     QMenu *pMenu = action(UIActionIndexRT_M_View_M_MenuBar)->menu();
     2372    UIMenu *pMenu = action(UIActionIndexRT_M_View_M_MenuBar)->menu();
    24752373    AssertPtrReturnVoid(pMenu);
    24762374    /* Clear contents: */
     
    24782376
    24792377    /* 'Menu Bar Settings' action: */
    2480     const bool fAllowToShowActionMenuBarSettings = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings);
    2481     action(UIActionIndexRT_M_View_M_MenuBar_S_Settings)->setEnabled(fAllowToShowActionMenuBarSettings);
    2482     if (fAllowToShowActionMenuBarSettings)
    2483         pMenu->addAction(action(UIActionIndexRT_M_View_M_MenuBar_S_Settings));
     2378    addAction(pMenu, action(UIActionIndexRT_M_View_M_MenuBar_S_Settings));
    24842379
    24852380    /* Mark menu as valid: */
     
    24902385{
    24912386    /* Get corresponding menu: */
    2492     QMenu *pMenu = action(UIActionIndexRT_M_View_M_StatusBar)->menu();
     2387    UIMenu *pMenu = action(UIActionIndexRT_M_View_M_StatusBar)->menu();
    24932388    AssertPtrReturnVoid(pMenu);
    24942389    /* Clear contents: */
     
    24962391
    24972392    /* 'Status Bar Settings' action: */
    2498     const bool fAllowToShowActionStatusBarSettings = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings);
    2499     action(UIActionIndexRT_M_View_M_StatusBar_S_Settings)->setEnabled(fAllowToShowActionStatusBarSettings);
    2500     if (fAllowToShowActionStatusBarSettings)
    2501         pMenu->addAction(action(UIActionIndexRT_M_View_M_StatusBar_S_Settings));
    2502 
     2393    addAction(pMenu, action(UIActionIndexRT_M_View_M_StatusBar_S_Settings));
    25032394    /* 'Toggle Status Bar' action: */
    2504     const bool fAllowToShowActionToggleStatusBar = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar);
    2505     action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->setEnabled(fAllowToShowActionToggleStatusBar);
    2506     if (fAllowToShowActionToggleStatusBar)
    2507         pMenu->addAction(action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility));
     2395    addAction(pMenu, action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility));
    25082396
    25092397    /* Mark menu as valid: */
     
    25782466                if (screenSize.width() == size.width() &&
    25792467                    screenSize.height() == size.height())
    2580                 {
    25812468                    pAction->setChecked(true);
    2582                 }
    25832469            }
    25842470        }
     
    26332519{
    26342520    /* Get corresponding menu: */
    2635     QMenu *pMenu = action(UIActionIndexRT_M_Devices)->menu();
     2521    UIMenu *pMenu = action(UIActionIndexRT_M_Devices)->menu();
    26362522    AssertPtrReturnVoid(pMenu);
    26372523    /* Clear contents: */
    26382524    pMenu->clear();
    26392525
    2640 
    26412526    /* Separator: */
    26422527    bool fSeparator = false;
    26432528
    2644 
    26452529    /* 'Hard Drives' submenu: */
    2646     const bool fAllowToShowActionHardDrives = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrives);
    2647     action(UIActionIndexRT_M_Devices_M_HardDrives)->setEnabled(fAllowToShowActionHardDrives);
    2648     if (fAllowToShowActionHardDrives)
    2649     {
    2650         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_HardDrives));
    2651         fSeparator = true;
    2652     }
     2530    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_HardDrives)) || fSeparator;
    26532531    updateMenuDevicesHardDrives();
    2654 
    26552532    /* 'Optical Devices' submenu: */
    2656     const bool fAllowToShowActionOpticalDevices = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices);
    2657     action(UIActionIndexRT_M_Devices_M_OpticalDevices)->setEnabled(fAllowToShowActionOpticalDevices);
    2658     if (fAllowToShowActionOpticalDevices)
    2659     {
    2660         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_OpticalDevices));
    2661         fSeparator = true;
    2662     }
    2663 
     2533    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_OpticalDevices)) || fSeparator;
    26642534    /* 'Floppy Devices' submenu: */
    2665     const bool fAllowToShowActionFloppyDevices = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices);
    2666     action(UIActionIndexRT_M_Devices_M_FloppyDevices)->setEnabled(fAllowToShowActionFloppyDevices);
    2667     if (fAllowToShowActionFloppyDevices)
    2668     {
    2669         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_FloppyDevices));
    2670         fSeparator = true;
    2671     }
    2672 
     2535    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_FloppyDevices)) || fSeparator;
    26732536    /* 'Network' submenu: */
    2674     const bool fAllowToShowActionNetwork = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network);
    2675     action(UIActionIndexRT_M_Devices_M_Network)->setEnabled(fAllowToShowActionNetwork);
    2676     if (fAllowToShowActionNetwork)
    2677     {
    2678         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_Network));
    2679         fSeparator = true;
    2680     }
     2537    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_Network)) || fSeparator;
    26812538    updateMenuDevicesNetwork();
    2682 
    26832539    /* 'USB Devices' submenu: */
    2684     const bool fAllowToShowActionUSBDevices = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices);
    2685     action(UIActionIndexRT_M_Devices_M_USBDevices)->setEnabled(fAllowToShowActionUSBDevices);
    2686     if (fAllowToShowActionUSBDevices)
    2687     {
    2688         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_USBDevices));
    2689         fSeparator = true;
    2690     }
     2540    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_USBDevices)) || fSeparator;
    26912541    updateMenuDevicesUSBDevices();
    2692 
    26932542    /* 'Web Cams' submenu: */
    2694     const bool fAllowToShowActionWebCams = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams);
    2695     action(UIActionIndexRT_M_Devices_M_WebCams)->setEnabled(fAllowToShowActionWebCams);
    2696     if (fAllowToShowActionWebCams)
    2697     {
    2698         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_WebCams));
    2699         fSeparator = true;
    2700     }
    2701 
     2543    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_WebCams)) || fSeparator;
    27022544    /* 'Shared Clipboard' submenu: */
    2703     const bool fAllowToShowActionSharedClipboard = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedClipboard);
    2704     action(UIActionIndexRT_M_Devices_M_SharedClipboard)->setEnabled(fAllowToShowActionSharedClipboard);
    2705     if (fAllowToShowActionSharedClipboard)
    2706     {
    2707         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_SharedClipboard));
    2708         fSeparator = true;
    2709     }
    2710 
     2545    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedClipboard)) || fSeparator;
    27112546    /* 'Drag&Drop' submenu: */
    2712     const bool fAllowToShowActionDragAndDrop = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_DragAndDrop);
    2713     action(UIActionIndexRT_M_Devices_M_DragAndDrop)->setEnabled(fAllowToShowActionDragAndDrop);
    2714     if (fAllowToShowActionDragAndDrop)
    2715     {
    2716         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_DragAndDrop));
    2717         fSeparator = true;
    2718     }
    2719 
     2547    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_DragAndDrop)) || fSeparator;
    27202548    /* 'Shared Folders' submenu: */
    2721     const bool fAllowToShowActionSharedFolders = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders);
    2722     action(UIActionIndexRT_M_Devices_M_SharedFolders)->setEnabled(fAllowToShowActionSharedFolders);
    2723     if (fAllowToShowActionSharedFolders)
    2724     {
    2725         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_SharedFolders));
    2726         fSeparator = true;
    2727     }
     2549    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedFolders)) || fSeparator;
    27282550    updateMenuDevicesSharedFolders();
    2729 
    27302551
    27312552    /* Separator: */
     
    27362557    }
    27372558
    2738 
    27392559    /* 'VRDE Server' action: */
    2740     const bool fAllowToShowActionVRDEServer = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VRDEServer);
    2741     action(UIActionIndexRT_M_Devices_T_VRDEServer)->setEnabled(fAllowToShowActionVRDEServer);
    2742     if (fAllowToShowActionVRDEServer)
    2743     {
    2744         pMenu->addAction(action(UIActionIndexRT_M_Devices_T_VRDEServer));
    2745         fSeparator = true;
    2746     }
    2747 
    2748     /* 'Video Capture' action: */
    2749     const bool fAllowToShowActionVideoCapture = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_StartVideoCapture);
    2750     action(UIActionIndexRT_M_Devices_M_VideoCapture_T_Start)->setEnabled(fAllowToShowActionVideoCapture);
    2751     if (fAllowToShowActionVideoCapture)
    2752     {
    2753         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_VideoCapture_T_Start));
    2754         fSeparator = true;
    2755     }
     2560    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_T_VRDEServer)) || fSeparator;
     2561    /* 'Video Capture' submenu: */
     2562    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_VideoCapture), false) || fSeparator;
    27562563    updateMenuDevicesVideoCapture();
    2757 
     2564    /* 'Video Capture Start' action: */
     2565    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_VideoCapture_T_Start)) || fSeparator;
    27582566
    27592567    /* Separator: */
     
    27642572    }
    27652573
    2766 
    27672574    /* Install Guest Tools action: */
    2768     const bool fAllowToShowActionInstallGuestTools = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InstallGuestTools);
    2769     action(UIActionIndexRT_M_Devices_S_InstallGuestTools)->setEnabled(fAllowToShowActionInstallGuestTools);
    2770     if (fAllowToShowActionInstallGuestTools)
    2771         pMenu->addAction(action(UIActionIndexRT_M_Devices_S_InstallGuestTools));
    2772 
     2575    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_S_InstallGuestTools)) || fSeparator;
    27732576
    27742577    /* Mark menu as valid: */
     
    27792582{
    27802583    /* Get corresponding menu: */
    2781     QMenu *pMenu = action(UIActionIndexRT_M_Devices_M_HardDrives)->menu();
     2584    UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_HardDrives)->menu();
    27822585    AssertPtrReturnVoid(pMenu);
    27832586    /* Clear contents: */
     
    27852588
    27862589    /* 'Hard Drives Settings' action: */
    2787     const bool fAllowToShowActionHardDrivesSettings = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrivesSettings);
    2788     action(UIActionIndexRT_M_Devices_M_HardDrives_S_Settings)->setEnabled(fAllowToShowActionHardDrivesSettings);
    2789     if (fAllowToShowActionHardDrivesSettings)
    2790         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_HardDrives_S_Settings));
     2590    addAction(pMenu, action(UIActionIndexRT_M_Devices_M_HardDrives_S_Settings));
    27912591
    27922592    /* Mark menu as valid: */
     
    27972597{
    27982598    /* Get corresponding menu: */
    2799     QMenu *pMenu = action(UIActionIndexRT_M_Devices_M_Network)->menu();
     2599    UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_Network)->menu();
    28002600    AssertPtrReturnVoid(pMenu);
    28012601    /* Clear contents: */
     
    28032603
    28042604    /* 'Network Settings' action: */
    2805     const bool fAllowToShowActionNetworkSettings = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings);
    2806     action(UIActionIndexRT_M_Devices_M_Network_S_Settings)->setEnabled(fAllowToShowActionNetworkSettings);
    2807     if (fAllowToShowActionNetworkSettings)
    2808         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_Network_S_Settings));
     2605    addAction(pMenu, action(UIActionIndexRT_M_Devices_M_Network_S_Settings));
     2606
     2607    /* This menu always remains invalid.. */
    28092608}
    28102609
     
    28122611{
    28132612    /* Get corresponding menu: */
    2814     QMenu *pMenu = action(UIActionIndexRT_M_Devices_M_USBDevices)->menu();
     2613    UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_USBDevices)->menu();
    28152614    AssertPtrReturnVoid(pMenu);
    28162615    /* Clear contents: */
     
    28182617
    28192618    /* 'USB Devices Settings' action: */
    2820     const bool fAllowToShowActionUSBDevicesSettings = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevicesSettings);
    2821     action(UIActionIndexRT_M_Devices_M_USBDevices_S_Settings)->setEnabled(fAllowToShowActionUSBDevicesSettings);
    2822     if (fAllowToShowActionUSBDevicesSettings)
    2823         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_USBDevices_S_Settings));
     2619    addAction(pMenu, action(UIActionIndexRT_M_Devices_M_USBDevices_S_Settings));
     2620
     2621    /* This menu always remains invalid.. */
    28242622}
    28252623
     
    28272625{
    28282626    /* Get corresponding menu: */
    2829     QMenu *pMenu = action(UIActionIndexRT_M_Devices_M_SharedFolders)->menu();
     2627    UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_SharedFolders)->menu();
    28302628    AssertPtrReturnVoid(pMenu);
    28312629    /* Clear contents: */
     
    28332631
    28342632    /* 'Shared Folders Settings' action: */
    2835     const bool fAllowToShowActionSharedFoldersSettings = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings);
    2836     action(UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings)->setEnabled(fAllowToShowActionSharedFoldersSettings);
    2837     if (fAllowToShowActionSharedFoldersSettings)
    2838         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings));
     2633    addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings));
    28392634
    28402635    /* Mark menu as valid: */
     
    28452640{
    28462641    /* Get corresponding menu: */
    2847     QMenu *pMenu = action(UIActionIndexRT_M_Devices_M_VideoCapture)->menu();
     2642    UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_VideoCapture)->menu();
    28482643    AssertPtrReturnVoid(pMenu);
    28492644    /* Clear contents: */
     
    28512646
    28522647    /* 'Video Capture Settings' action: */
    2853     const bool fAllowToShowActionVideoCaptureSettings = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VideoCaptureSettings);
    2854     action(UIActionIndexRT_M_Devices_M_VideoCapture_S_Settings)->setEnabled(fAllowToShowActionVideoCaptureSettings);
    2855     if (fAllowToShowActionVideoCaptureSettings)
    2856         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_VideoCapture_S_Settings));
    2857 
     2648    addAction(pMenu, action(UIActionIndexRT_M_Devices_M_VideoCapture_S_Settings));
    28582649    /* 'Start Video Capture' action: */
    2859     const bool fAllowToShowActionStartVideoCapture = isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_StartVideoCapture);
    2860     action(UIActionIndexRT_M_Devices_M_VideoCapture_S_Settings)->setEnabled(fAllowToShowActionStartVideoCapture);
    2861     if (fAllowToShowActionStartVideoCapture)
    2862         pMenu->addAction(action(UIActionIndexRT_M_Devices_M_VideoCapture_T_Start));
     2650    addAction(pMenu, action(UIActionIndexRT_M_Devices_M_VideoCapture_S_Settings));
    28632651
    28642652    /* Mark menu as valid: */
     
    28702658{
    28712659    /* Get corresponding menu: */
    2872     QMenu *pMenu = action(UIActionIndexRT_M_Debug)->menu();
     2660    UIMenu *pMenu = action(UIActionIndexRT_M_Debug)->menu();
    28732661    AssertPtrReturnVoid(pMenu);
    28742662    /* Clear contents: */
     
    28762664
    28772665    /* 'Statistics' action: */
    2878     const bool fAllowToShowActionStatistics = isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics);
    2879     action(UIActionIndexRT_M_Debug_S_ShowStatistics)->setEnabled(fAllowToShowActionStatistics);
    2880     if (fAllowToShowActionStatistics)
    2881         pMenu->addAction(action(UIActionIndexRT_M_Debug_S_ShowStatistics));
    2882 
     2666    addAction(pMenu, action(UIActionIndexRT_M_Debug_S_ShowStatistics));
    28832667    /* 'Command Line' action: */
    2884     const bool fAllowToShowActionCommandLine = isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine);
    2885     action(UIActionIndexRT_M_Debug_S_ShowCommandLine)->setEnabled(fAllowToShowActionCommandLine);
    2886     if (fAllowToShowActionCommandLine)
    2887         pMenu->addAction(action(UIActionIndexRT_M_Debug_S_ShowCommandLine));
    2888 
     2668    addAction(pMenu, action(UIActionIndexRT_M_Debug_S_ShowCommandLine));
    28892669    /* 'Logging' action: */
    2890     const bool fAllowToShowActionLogging = isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging);
    2891     action(UIActionIndexRT_M_Debug_T_Logging)->setEnabled(fAllowToShowActionLogging);
    2892     if (fAllowToShowActionLogging)
    2893         pMenu->addAction(action(UIActionIndexRT_M_Debug_T_Logging));
    2894 
     2670    addAction(pMenu, action(UIActionIndexRT_M_Debug_T_Logging));
    28952671    /* 'Log Dialog' action: */
    2896     const bool fAllowToShowActionLogDialog = isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_LogDialog);
    2897     action(UIActionIndexRT_M_Debug_S_ShowLogDialog)->setEnabled(fAllowToShowActionLogDialog);
    2898     if (fAllowToShowActionLogDialog)
    2899         pMenu->addAction(action(UIActionIndexRT_M_Debug_S_ShowLogDialog));
     2672    addAction(pMenu, action(UIActionIndexRT_M_Debug_S_ShowLogDialog));
    29002673
    29012674    /* Mark menu as valid: */
Note: See TracChangeset for help on using the changeset viewer.

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