VirtualBox

Ignore:
Timestamp:
Feb 5, 2014 12:40:02 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
92048
Message:

FE/Qt: 4397: Medium Manager cleanup/rework (part 2): Actions-update functionality decomposition.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r50325 r50326  
    604604    }
    605605
    606     /* Update action availability: */
    607     bool fNotInEnumeration = !vboxGlobal().isMediumEnumerationInProgress();
    608     bool fActionEnabledCopy    = currentTreeWidgetType() == UIMediumType_HardDisk &&
    609                                  fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Copy);
    610     bool fActionEnabledModify  = currentTreeWidgetType() == UIMediumType_HardDisk &&
    611                                  fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Modify);
    612     bool fActionEnabledRemove  = fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Remove);
    613     bool fActionEnabledRelease = pMediumItem && checkMediumFor(pMediumItem, Action_Release);
    614     m_pActionCopy->setEnabled(fActionEnabledCopy);
    615     m_pActionModify->setEnabled(fActionEnabledModify);
    616     m_pActionRemove->setEnabled(fActionEnabledRemove);
    617     m_pActionRelease->setEnabled(fActionEnabledRelease);
     606    /* Update actions: */
     607    updateActions();
    618608
    619609    /* Update information-panes: */
     
    10871077}
    10881078
     1079void UIMediumManager::updateActions()
     1080{
     1081    /* Get current-item: */
     1082    UIMediumItem *pCurrentItem = toMediumItem(currentTreeWidget()->currentItem());
     1083
     1084    /* Calculate actions accessibility: */
     1085    bool fNotInEnumeration = !vboxGlobal().isMediumEnumerationInProgress();
     1086    bool fActionEnabledCopy = currentTreeWidgetType() == UIMediumType_HardDisk &&
     1087                              fNotInEnumeration && pCurrentItem && checkMediumFor(pCurrentItem, Action_Copy);
     1088    bool fActionEnabledModify = currentTreeWidgetType() == UIMediumType_HardDisk &&
     1089                                fNotInEnumeration && pCurrentItem && checkMediumFor(pCurrentItem, Action_Modify);
     1090    bool fActionEnabledRemove = fNotInEnumeration && pCurrentItem && checkMediumFor(pCurrentItem, Action_Remove);
     1091    bool fActionEnabledRelease = fNotInEnumeration && pCurrentItem && checkMediumFor(pCurrentItem, Action_Release);
     1092
     1093    /* Update actions: */
     1094    m_pActionCopy->setEnabled(fActionEnabledCopy);
     1095    m_pActionModify->setEnabled(fActionEnabledModify);
     1096    m_pActionRemove->setEnabled(fActionEnabledRemove);
     1097    m_pActionRelease->setEnabled(fActionEnabledRelease);
     1098}
     1099
    10891100#ifdef Q_WS_MAC
    10901101void UIMediumManager::cleanupMacWindowMenu()
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h

    r50325 r50326  
    121121    void populateTreeWidgets();
    122122
     123    /** Creates UIMediumItem for corresponding UIMedium. */
     124    void updateActions();
     125
    123126    /* Helpers: Cleanup stuff: */
    124127#ifdef Q_WS_MAC
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