void UIHostNetworkManagerWidget::loadHostNetworks() { /* Clear tree first of all: */ m_pTreeWidget->clear(); /* Get host for further activities: */ const CHost comHost = vboxGlobal().host(); /* Get interfaces for further activities: */ const QVector<CHostNetworkInterface> interfaces = comHost.GetNetworkInterfaces(); /* Show error message if necessary: */ if (!comHost.isOk()) msgCenter().cannotAcquireHostNetworkInterfaces(comHost, this); else { /* For each host-only interface => load it to the tree: */ foreach (const CHostNetworkInterface &comInterface, interfaces) if (comInterface.GetInterfaceType() == KHostNetworkInterfaceType_HostOnly) { UIDataHostNetwork data; loadHostNetwork(comInterface, data); createItemForNetworkHost(data, false); } /* Choose the 1st item as current initially: */ m_pTreeWidget->setCurrentItem(m_pTreeWidget->topLevelItem(0)); sltHandleCurrentItemChange(); /* Adjust tree-widget: */ sltAdjustTreeWidget(); } }