VirtualBox

Changeset 92810 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 8, 2021 1:21:20 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9871: Fixing regression after moving NAT networks code to Network Manager; Availability for Remove action should always be updated according to current tab-widget index.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UINetworkManager.cpp

    r92763 r92810  
    915915void UINetworkManagerWidget::sltHandleCurrentTabWidgetIndexChange()
    916916{
     917    /* Update actions: */
     918    updateActionAvailability();
     919
    917920    /* Adjust tree-widgets first of all: */
    918921    sltAdjustTreeWidgets();
     
    10321035void UINetworkManagerWidget::sltHandleCurrentItemChangeHostNetwork()
    10331036{
     1037    /* Update actions: */
     1038    updateActionAvailability();
     1039
    10341040    /* Check host network tree-widget: */
    10351041    AssertMsgReturnVoid(m_pTreeWidgetHostNetwork, ("Host network tree-widget isn't created!\n"));
     
    10371043    /* Get network item: */
    10381044    UIItemHostNetwork *pItem = static_cast<UIItemHostNetwork*>(m_pTreeWidgetHostNetwork->currentItem());
    1039 
    1040     /* Update actions availability: */
    1041     m_pActionPool->action(UIActionIndexMN_M_Network_S_Remove)->setEnabled(pItem);
    10421045
    10431046    /* Check host network details-widget: */
     
    12081211void UINetworkManagerWidget::sltHandleCurrentItemChangeNATNetworkHoldingPosition(bool fHoldPosition)
    12091212{
     1213    /* Update actions: */
     1214    updateActionAvailability();
     1215
    12101216    /* Check NAT network tree-widget: */
    12111217    AssertMsgReturnVoid(m_pTreeWidgetNATNetwork, ("NAT network tree-widget isn't created!\n"));
     
    12131219    /* Get network item: */
    12141220    UIItemNATNetwork *pItem = static_cast<UIItemNATNetwork*>(m_pTreeWidgetNATNetwork->currentItem());
    1215 
    1216     /* Update actions availability: */
    1217     m_pActionPool->action(UIActionIndexMN_M_Network_S_Remove)->setEnabled(pItem);
    12181221
    12191222    /* Check NAT network details-widget: */
     
    13761379void UINetworkManagerWidget::sltHandleCurrentItemChangeCloudNetwork()
    13771380{
     1381    /* Update actions: */
     1382    updateActionAvailability();
     1383
    13781384    /* Check cloud network tree-widget: */
    13791385    AssertMsgReturnVoid(m_pTreeWidgetCloudNetwork, ("Cloud network tree-widget isn't created!\n"));
     
    13811387    /* Get network item: */
    13821388    UIItemCloudNetwork *pItem = static_cast<UIItemCloudNetwork*>(m_pTreeWidgetCloudNetwork->currentItem());
    1383 
    1384     /* Update actions availability: */
    1385     m_pActionPool->action(UIActionIndexMN_M_Network_S_Remove)->setEnabled(pItem);
    13861389
    13871390    /* Check Cloud network details-widget: */
     
    20712074}
    20722075
     2076void UINetworkManagerWidget::updateActionAvailability()
     2077{
     2078    /* Check which tab we have currently: */
     2079    switch (m_pTabWidget->currentIndex())
     2080    {
     2081        case TabWidgetIndex_HostNetwork:
     2082        {
     2083            AssertMsgReturnVoid(m_pTreeWidgetHostNetwork, ("Host network tree-widget isn't created!\n"));
     2084            UIItemHostNetwork *pItem = static_cast<UIItemHostNetwork*>(m_pTreeWidgetHostNetwork->currentItem());
     2085            m_pActionPool->action(UIActionIndexMN_M_Network_S_Remove)->setEnabled(pItem);
     2086            break;
     2087        }
     2088        case TabWidgetIndex_NATNetwork:
     2089        {
     2090            AssertMsgReturnVoid(m_pTreeWidgetNATNetwork, ("NAT network tree-widget isn't created!\n"));
     2091            UIItemNATNetwork *pItem = static_cast<UIItemNATNetwork*>(m_pTreeWidgetNATNetwork->currentItem());
     2092            m_pActionPool->action(UIActionIndexMN_M_Network_S_Remove)->setEnabled(pItem);
     2093            break;
     2094        }
     2095        case TabWidgetIndex_CloudNetwork:
     2096        {
     2097            AssertMsgReturnVoid(m_pTreeWidgetCloudNetwork, ("Cloud network tree-widget isn't created!\n"));
     2098            UIItemCloudNetwork *pItem = static_cast<UIItemCloudNetwork*>(m_pTreeWidgetCloudNetwork->currentItem());
     2099            m_pActionPool->action(UIActionIndexMN_M_Network_S_Remove)->setEnabled(pItem);
     2100            break;
     2101        }
     2102        default:
     2103            break;
     2104    }
     2105}
     2106
    20732107void UINetworkManagerWidget::createItemForHostNetwork(const UIDataHostNetwork &data, bool fChooseItem)
    20742108{
  • trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UINetworkManager.h

    r92731 r92810  
    225225    /** @} */
    226226
     227    /** @name Actions stuff.
     228      * @{ */
     229        /** Updates action availability. */
     230        void updateActionAvailability();
     231    /** @} */
     232
    227233    /** @name Tree-widget stuff.
    228234      * @{ */
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