VirtualBox

Changeset 49466 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 13, 2013 1:35:56 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: Close actions handling rework (step 2): Make sure menu/menubar Application Close action is disabled if SaveState, Shutdown and PowerOff close actions are restricted.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp

    r49462 r49466  
    225225#endif /* !Q_WS_MAC */
    226226    pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Close));
     227    if (m_pSession->isAllCloseActionsRestricted())
     228        gActionPool->action(UIActionIndexRuntime_Simple_Close)->setEnabled(false);
    227229}
    228230
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r49465 r49466  
    134134    , m_defaultCloseAction(MachineCloseAction_Invalid)
    135135    , m_restrictedCloseActions(MachineCloseAction_Invalid)
     136    , m_fAllCloseActionsRestricted(false)
    136137    , m_fSnapshotOperationsAllowed(true)
    137138    /* Common flags: */
     
    10921093        m_defaultCloseAction = vboxGlobal().defaultMachineCloseAction(machine);
    10931094        m_restrictedCloseActions = vboxGlobal().restrictedMachineCloseActions(machine);
     1095        m_fAllCloseActionsRestricted =  (m_restrictedCloseActions & MachineCloseAction_SaveState)
     1096                                     && (m_restrictedCloseActions & MachineCloseAction_Shutdown)
     1097                                     && (m_restrictedCloseActions & MachineCloseAction_PowerOff);
     1098                                     // Close VM Dialog hides PowerOff_RestoringSnapshot implicitly if PowerOff is hidden..
     1099                                     // && (m_restrictedCloseActions & MachineCloseAction_PowerOff_RestoringSnapshot);
    10941100
    10951101        /* Should we allow snapshot operations? */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r49465 r49466  
    111111    /** Returns merged restricted close actions. */
    112112    MachineCloseAction restrictedCloseActions() const { return m_restrictedCloseActions; }
     113    /** Returns whether all the close actions are restricted. */
     114    bool isAllCloseActionsRestricted() const { return m_fAllCloseActionsRestricted; }
    113115    /** @} */
    114116
     
    333335    /** Merged restricted close actions. */
    334336    MachineCloseAction m_restrictedCloseActions;
     337    /** Determines whether all the close actions are restricted. */
     338    bool m_fAllCloseActionsRestricted;
    335339    /** @} */
    336340
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