VirtualBox

Ignore:
Timestamp:
Jan 15, 2021 1:53:46 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9871: UIDetailsWidgetHostNetwork: Disable details-widget contents if host-only network is Null.

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

Legend:

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

    r87269 r87275  
    775775void UIDetailsWidgetHostNetwork::loadDataForInterface()
    776776{
     777    /* Check whether interface exists and configurable: */
     778    const bool fIsInterfaceExists = m_newData.m_interface.m_fExists;
     779    const bool fIsInterfaceConfigurable = !m_newData.m_interface.m_fDHCPEnabled;
     780
     781    /* Toggle radio-buttons availability: */
     782    if (m_pButtonAutomatic)
     783        m_pButtonAutomatic->setEnabled(fIsInterfaceExists);
     784    if (m_pButtonManual)
     785        m_pButtonManual->setEnabled(fIsInterfaceExists);
     786
    777787    /* Toggle IPv4 & IPv6 interface fields availability: */
    778     const bool fIsInterfaceConfigurable = !m_newData.m_interface.m_fDHCPEnabled;
    779788    if (m_pLabelIPv4)
    780         m_pLabelIPv4->setEnabled(fIsInterfaceConfigurable);
     789        m_pLabelIPv4->setEnabled(fIsInterfaceExists && fIsInterfaceConfigurable);
    781790    if (m_pLabelNMv4)
    782         m_pLabelNMv4->setEnabled(fIsInterfaceConfigurable);
     791        m_pLabelNMv4->setEnabled(fIsInterfaceExists && fIsInterfaceConfigurable);
    783792    if (m_pEditorIPv4)
    784         m_pEditorIPv4->setEnabled(fIsInterfaceConfigurable);
     793        m_pEditorIPv4->setEnabled(fIsInterfaceExists && fIsInterfaceConfigurable);
    785794    if (m_pEditorNMv4)
    786         m_pEditorNMv4->setEnabled(fIsInterfaceConfigurable);
     795        m_pEditorNMv4->setEnabled(fIsInterfaceExists && fIsInterfaceConfigurable);
    787796
    788797    /* Load IPv4 interface fields: */
     
    799808    const bool fIsIpv6Configurable = fIsInterfaceConfigurable && m_newData.m_interface.m_fSupportedIPv6;
    800809    if (m_pLabelIPv6)
    801         m_pLabelIPv6->setEnabled(fIsIpv6Configurable);
     810        m_pLabelIPv6->setEnabled(fIsInterfaceExists && fIsIpv6Configurable);
    802811    if (m_pLabelNMv6)
    803         m_pLabelNMv6->setEnabled(fIsIpv6Configurable);
     812        m_pLabelNMv6->setEnabled(fIsInterfaceExists && fIsIpv6Configurable);
    804813    if (m_pEditorIPv6)
    805         m_pEditorIPv6->setEnabled(fIsIpv6Configurable);
     814        m_pEditorIPv6->setEnabled(fIsInterfaceExists && fIsIpv6Configurable);
    806815    if (m_pEditorNMv6)
    807         m_pEditorNMv6->setEnabled(fIsIpv6Configurable);
     816        m_pEditorNMv6->setEnabled(fIsInterfaceExists && fIsIpv6Configurable);
    808817
    809818    /* Load IPv6 interface fields: */
     
    816825void UIDetailsWidgetHostNetwork::loadDataForDHCPServer()
    817826{
     827    /* Check whether interface exists and DHCP server available: */
     828    const bool fIsInterfaceExists = m_newData.m_interface.m_fExists;
     829    const bool fIsDHCPServerEnabled = m_newData.m_dhcpserver.m_fEnabled;
     830
     831    /* Toggle check-box availability: */
     832    m_pCheckBoxDHCP->setEnabled(fIsInterfaceExists);
     833
    818834    /* Toggle DHCP server fields availability: */
    819     const bool fIsDHCPServerEnabled = m_newData.m_dhcpserver.m_fEnabled;
    820835    if (m_pLabelDHCPAddress)
    821         m_pLabelDHCPAddress->setEnabled(fIsDHCPServerEnabled);
     836        m_pLabelDHCPAddress->setEnabled(fIsInterfaceExists && fIsDHCPServerEnabled);
    822837    if (m_pLabelDHCPMask)
    823         m_pLabelDHCPMask->setEnabled(fIsDHCPServerEnabled);
     838        m_pLabelDHCPMask->setEnabled(fIsInterfaceExists && fIsDHCPServerEnabled);
    824839    if (m_pLabelDHCPLowerAddress)
    825         m_pLabelDHCPLowerAddress->setEnabled(fIsDHCPServerEnabled);
     840        m_pLabelDHCPLowerAddress->setEnabled(fIsInterfaceExists && fIsDHCPServerEnabled);
    826841    if (m_pLabelDHCPUpperAddress)
    827         m_pLabelDHCPUpperAddress->setEnabled(fIsDHCPServerEnabled);
     842        m_pLabelDHCPUpperAddress->setEnabled(fIsInterfaceExists && fIsDHCPServerEnabled);
    828843    if (m_pEditorDHCPAddress)
    829         m_pEditorDHCPAddress->setEnabled(fIsDHCPServerEnabled);
     844        m_pEditorDHCPAddress->setEnabled(fIsInterfaceExists && fIsDHCPServerEnabled);
    830845    if (m_pEditorDHCPMask)
    831         m_pEditorDHCPMask->setEnabled(fIsDHCPServerEnabled);
     846        m_pEditorDHCPMask->setEnabled(fIsInterfaceExists && fIsDHCPServerEnabled);
    832847    if (m_pEditorDHCPLowerAddress)
    833         m_pEditorDHCPLowerAddress->setEnabled(fIsDHCPServerEnabled);
     848        m_pEditorDHCPLowerAddress->setEnabled(fIsInterfaceExists && fIsDHCPServerEnabled);
    834849    if (m_pEditorDHCPUpperAddress)
    835         m_pEditorDHCPUpperAddress->setEnabled(fIsDHCPServerEnabled);
     850        m_pEditorDHCPUpperAddress->setEnabled(fIsInterfaceExists && fIsDHCPServerEnabled);
    836851
    837852    /* Load DHCP server fields: */
  • trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UIDetailsWidgetHostNetwork.h

    r87232 r87275  
    4444    /** Constructs data. */
    4545    UIDataHostNetworkInterface()
    46         : m_strName(QString())
     46        : m_fExists(false)
     47        , m_strName(QString())
    4748        , m_fDHCPEnabled(false)
    4849        , m_strAddress(QString())
     
    5758    {
    5859        return true
     60               && (m_fExists == other.m_fExists)
    5961               && (m_strName == other.m_strName)
    6062               && (m_fDHCPEnabled == other.m_fDHCPEnabled)
     
    7274    bool operator!=(const UIDataHostNetworkInterface &other) const { return !equal(other); }
    7375
     76    /** Holds this interface is not NULL. */
     77    bool     m_fExists;
    7478    /** Holds interface name. */
    7579    QString  m_strName;
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