VirtualBox

Changeset 67251 in vbox for trunk


Ignore:
Timestamp:
Jun 2, 2017 3:42:28 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8847: Host Network Manager: A bit of shine and paranoia.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkDetailsDialog.cpp

    r67127 r67251  
    6363void UIHostNetworkDetailsDialog::setData(const UIDataHostNetwork &data)
    6464{
    65     /* Save old data: */
     65    /* Cache old/new data: */
    6666    m_oldData = data;
    67     /* Copy old data to new one: */
    6867    m_newData = m_oldData;
    6968
  • trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkManager.cpp

    r67087 r67251  
    410410}
    411411
    412 void UIHostNetworkManagerWidget::sltToggleHostNetworkDetailsVisibility(bool fShow)
     412void UIHostNetworkManagerWidget::sltToggleHostNetworkDetailsVisibility(bool fVisible)
    413413{
    414414    /* Show/hide details area and Apply button: */
    415     m_pDetailsWidget->setVisible(fShow);
    416     m_pActionCommit->setVisible(fShow);
    417 }
    418 
    419 void UIHostNetworkManagerWidget::sltApplyHostNetworkDetailsChanges()
     415    m_pDetailsWidget->setVisible(fVisible);
     416    m_pActionCommit->setVisible(fVisible);
     417}
     418
     419void UIHostNetworkManagerWidget::sltCommitHostNetworkDetailsChanges()
    420420{
    421421    /* Disable button first of all: */
     
    654654
    655655    /* Update actions availability: */
    656     m_pActionRemove->setEnabled(pItem);
    657     m_pActionDetails->setEnabled(pItem);
    658     m_pActionCommit->setEnabled(false);
     656    if (m_pActionRemove)
     657        m_pActionRemove->setEnabled(pItem);
     658    if (m_pActionDetails)
     659        m_pActionDetails->setEnabled(pItem);
     660    if (m_pActionCommit)
     661        m_pActionCommit->setEnabled(false);
    659662
    660663    /* If there is an item => update details data: */
     
    675678    if (m_pTreeWidget->itemAt(pos))
    676679    {
    677         menu.addAction(m_pActionRemove);
    678         menu.addAction(m_pActionDetails);
    679         menu.addAction(m_pActionCommit);
     680        if (m_pActionRemove)
     681            menu.addAction(m_pActionRemove);
     682        if (m_pActionDetails)
     683            menu.addAction(m_pActionDetails);
     684        if (m_pActionCommit)
     685            menu.addAction(m_pActionCommit);
    680686    }
    681687    else
    682688    {
    683         menu.addAction(m_pActionAdd);
     689        if (m_pActionAdd)
     690            menu.addAction(m_pActionAdd);
    684691    }
    685692    /* And show it: */
     
    760767                                                         ":/commit_host_iface_disabled_22px.png",
    761768                                                         ":/commit_host_iface_disabled_16px.png"));
    762         connect(m_pActionDetails, &QAction::toggled, m_pActionCommit, &QAction::setVisible);
    763         connect(m_pActionCommit, &QAction::triggered, this, &UIHostNetworkManagerWidget::sltApplyHostNetworkDetailsChanges);
     769        if (m_pActionDetails)
     770            connect(m_pActionDetails, &QAction::toggled, m_pActionCommit, &QAction::setVisible);
     771        connect(m_pActionCommit, &QAction::triggered, this, &UIHostNetworkManagerWidget::sltCommitHostNetworkDetailsChanges);
    764772    }
    765773
     
    775783    {
    776784        /* Configure menu: */
    777         m_pMenu->addAction(m_pActionAdd);
    778         m_pMenu->addAction(m_pActionRemove);
    779         m_pMenu->addAction(m_pActionDetails);
    780         m_pMenu->addAction(m_pActionCommit);
     785        if (m_pActionAdd)
     786            m_pMenu->addAction(m_pActionAdd);
     787        if (m_pActionRemove)
     788            m_pMenu->addAction(m_pActionRemove);
     789        if (m_pActionDetails)
     790            m_pMenu->addAction(m_pActionDetails);
     791        if (m_pActionCommit)
     792            m_pMenu->addAction(m_pActionCommit);
    781793    }
    782794}
     
    861873        connect(m_pTreeWidget, &QITreeWidget::itemChanged,
    862874                this, &UIHostNetworkManagerWidget::sltHandleItemChange);
    863         connect(m_pTreeWidget, &QITreeWidget::itemDoubleClicked,
    864                 m_pActionDetails, &QAction::setChecked);
     875        if (m_pActionDetails)
     876            connect(m_pTreeWidget, &QITreeWidget::itemDoubleClicked,
     877                    m_pActionDetails, &QAction::setChecked);
    865878
    866879        /* Add into layout: */
     
    878891        m_pDetailsWidget->setVisible(false);
    879892        m_pDetailsWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    880         connect(m_pDetailsWidget, &UIHostNetworkDetailsDialog::sigDataChanged,
    881                 m_pActionCommit, &QAction::setEnabled);
     893        if (m_pActionCommit)
     894            connect(m_pDetailsWidget, &UIHostNetworkDetailsDialog::sigDataChanged,
     895                    m_pActionCommit, &QAction::setEnabled);
    882896
    883897        /* Add into layout: */
     
    10561070        setWidgetToolbar(pWidget->toolbar());
    10571071#endif
    1058         /* Add to layout: */
     1072        /* Add into layout: */
    10591073        centralWidget()->layout()->addWidget(pWidget);
    10601074    }
  • trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkManager.h

    r67122 r67251  
    8080        /** Handles command to make host network details @a fVisible. */
    8181        void sltToggleHostNetworkDetailsVisibility(bool fVisible);
    82         /** Handles command to apply host network details changes. */
    83         void sltApplyHostNetworkDetailsChanges();
     82        /** Handles command to commit host network details changes. */
     83        void sltCommitHostNetworkDetailsChanges();
    8484    /** @} */
    8585
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