Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsNetworkDetails.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsNetworkDetails.h	(revision 17788)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsNetworkDetails.h	(revision 17788)
@@ -0,0 +1,77 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsNetworkDetails class declaration
+ */
+
+/*
+ * Copyright (C) 2008 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxVMSettingsNetworkDetails_h__
+#define __VBoxVMSettingsNetworkDetails_h__
+
+/* VBox Includes */
+#include "QIDialog.h"
+#include "QIWithRetranslateUI.h"
+#include "VBoxVMSettingsNetworkDetails.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsNetworkDetails : public QIWithRetranslateUI2 <QIDialog>,
+                                     public Ui::VBoxVMSettingsNetworkDetails
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsNetworkDetails (QWidget *aParent);
+
+    void getFromAdapter (const CNetworkAdapter &mAdapter);
+    void putBackToAdapter();
+
+    void loadList (KNetworkAttachmentType aType, const QStringList &aList);
+
+    bool revalidate (KNetworkAttachmentType aType, QString &aWarning);
+
+    QString currentName (KNetworkAttachmentType aType = KNetworkAttachmentType_Null) const;
+
+protected:
+
+    void retranslateUi();
+    void showEvent (QShowEvent *aEvent);
+
+private slots:
+
+    void accept();
+    void hostOnlyInterfaceChanged();
+    void hostOnlyDHCPChanged();
+    void genMACClicked();
+#if defined (Q_WS_WIN32)
+    void addInterface();
+    void delInterface();
+#endif
+
+private:
+
+    void populateComboboxes();
+    QComboBox* comboBox() const;
+
+    KNetworkAttachmentType mType;
+    CNetworkAdapter mAdapter;
+    QString mNotSelected;
+};
+
+#endif // __VBoxVMSettingsNetworkDetails_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsNetworkDetails.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsNetworkDetails.cpp	(revision 17788)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsNetworkDetails.cpp	(revision 17788)
@@ -0,0 +1,619 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsNetworkDetails class implementation
+ */
+
+/*
+ * Copyright (C) 2008 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+/* VBox Includes */
+#include "VBoxGlobal.h"
+#include "VBoxProblemReporter.h"
+#include "VBoxVMSettingsNetworkDetails.h"
+
+/* Qt Includes */
+#include <QHostAddress>
+
+/* Empty item extra-code */
+const char *emptyItemCode = "#empty#";
+
+/* VBoxVMSettingsNetwork Stuff */
+VBoxVMSettingsNetworkDetails::VBoxVMSettingsNetworkDetails (QWidget *aParent)
+    : QIWithRetranslateUI2 <QIDialog> (aParent
+#ifdef Q_WS_MAC
+    ,Qt::Sheet
+#else
+    ,Qt::Tool
+#endif /* Q_WS_MAC */
+    )
+    , mType (KNetworkAttachmentType_Null)
+{
+    /* Apply UI decorations */
+    Ui::VBoxVMSettingsNetworkDetails::setupUi (this);
+
+    /* Setup alternative widgets */
+    mCbNAT->setInsertPolicy (QComboBox::NoInsert);
+    mCbINT->setInsertPolicy (QComboBox::NoInsert);
+    mLeIPv4->setValidator (new QRegExpValidator
+        (QRegExp ("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"), this));
+    mLeHMv4->setValidator (new QRegExpValidator
+        (QRegExp ("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"), this));
+    //mLeIPv6->setValidator (new QRegExpValidator
+    //    (QRegExp ("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"), this));
+    //mLeHMv6->setValidator (new QRegExpValidator
+    //    (QRegExp ("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"), this));
+    connect (mCbHOI, SIGNAL (currentIndexChanged (int)),
+             this, SLOT (hostOnlyInterfaceChanged()));
+    connect (mRbAuto, SIGNAL (toggled (bool)),
+             this, SLOT (hostOnlyDHCPChanged()));
+    connect (mRbManual, SIGNAL (toggled (bool)),
+             this, SLOT (hostOnlyDHCPChanged()));
+    populateComboboxes();
+#if defined (Q_WS_WIN32)
+    mTbAdd->setIcon (VBoxGlobal::iconSet (":/add_host_iface_16px.png",
+                                          ":/add_host_iface_disabled_16px.png"));
+    mTbDel->setIcon (VBoxGlobal::iconSet (":/remove_host_iface_16px.png",
+                                          ":/remove_host_iface_disabled_16px.png"));
+    connect (mTbAdd, SIGNAL (clicked()), this, SLOT (addInterface()));
+    connect (mTbDel, SIGNAL (clicked()), this, SLOT (delInterface()));
+#endif
+
+    /* Setup common widgets */
+    mLeMAC->setValidator (new QRegExpValidator
+        (QRegExp ("[0-9A-Fa-f][02468ACEace][0-9A-Fa-f]{10}"), this));
+    QStyleOption options;
+    options.initFrom (mLeMAC);
+    QSize contentSize (mLeMAC->fontMetrics().width ('X') * 12,
+                       mLeMAC->fontMetrics().xHeight());
+    QSize totalSize = style()->sizeFromContents (QStyle::CT_LineEdit,
+                                                 &options, contentSize, this);
+    mLeMAC->setMinimumWidth (totalSize.width());
+    connect (mTbMAC, SIGNAL (clicked()), this, SLOT (genMACClicked()));
+#if defined (Q_WS_MAC)
+    /* Remove tool-button border at MAC */
+    mTbMAC->setStyleSheet ("QToolButton {border: 0px none black;}");
+#endif /* Q_WS_MAC */
+}
+
+void VBoxVMSettingsNetworkDetails::getFromAdapter (const CNetworkAdapter &aAdapter)
+{
+    mAdapter = aAdapter;
+
+    /* Load alternate attributes */
+    QString natName (mAdapter.GetNATNetwork());
+    if (!natName.isEmpty())
+        setProperty ("NAT_Name", QVariant (natName));
+
+    QString intName (mAdapter.GetInternalNetwork());
+    if (!intName.isEmpty())
+        setProperty ("INT_Name", QVariant (intName));
+
+    QString ifsName (mAdapter.GetHostInterface());
+    CHostNetworkInterface ifs =
+        vboxGlobal().virtualBox().GetHost().FindHostNetworkInterfaceByName (ifsName);
+    if (!ifs.isNull() && ifs.GetInterfaceType() == KHostNetworkInterfaceType_Bridged)
+    {
+        setProperty ("BRG_Name", QVariant (ifsName));
+    }
+    else if (!ifs.isNull() && ifs.GetInterfaceType() == KHostNetworkInterfaceType_HostOnly)
+    {
+        setProperty ("HOI_Name", QVariant (ifsName));
+        setProperty ("HOI_DhcpEnabled", QVariant (ifs.GetDhcpEnabled()));
+        setProperty ("HOI_IPv6Supported", QVariant (ifs.GetIPV6Supported()));
+        if (!ifs.GetDhcpEnabled())
+        {
+            setProperty ("HOI_IPv4Addr", QVariant (ifs.GetIPAddress()));
+            setProperty ("HOI_IPv4Mask", QVariant (ifs.GetNetworkMask()));
+            if (ifs.GetIPV6Supported())
+            {
+                setProperty ("HOI_IPv6Addr", QVariant (ifs.GetIPV6Address()));
+                setProperty ("HOI_IPv6Mask", QVariant (QString::number (ifs.GetIPV6NetworkMaskPrefixLength())));
+            }
+        }
+    }
+
+    setProperty ("MAC_Address", QVariant (aAdapter.GetMACAddress()));
+}
+
+void VBoxVMSettingsNetworkDetails::putBackToAdapter()
+{
+    /* Save alternative settings */
+    QString name (currentName());
+    switch (mType)
+    {
+        case KNetworkAttachmentType_NAT:
+        {
+            mAdapter.SetNATNetwork (name);
+            break;
+        }
+        case KNetworkAttachmentType_Bridged:
+        {
+            mAdapter.SetHostInterface (name);
+            break;
+        }
+        case KNetworkAttachmentType_Internal:
+        {
+            mAdapter.SetInternalNetwork (name);
+            break;
+        }
+        case KNetworkAttachmentType_HostOnly:
+        {
+            CHostNetworkInterface iface =
+                vboxGlobal().virtualBox().GetHost().FindHostNetworkInterfaceByName (name);
+            if (!iface.isNull())
+            {
+                if (property ("HOI_DhcpEnabled").toBool())
+                {
+                    iface.EnableDynamicIpConfig();
+                }
+                else
+                {
+                    iface.EnableStaticIpConfig (property ("HOI_IPv4Addr").toString(),
+                                                property ("HOI_IPv4Mask").toString());
+
+                    if (property ("HOI_IPv6Supported").toBool())
+                    {
+                        iface.EnableStaticIpConfigV6 (property ("HOI_IPv6Addr").toString(),
+                                                      property ("HOI_IPv6Mask").toString().toULong());
+                    }
+                }
+            }
+            mAdapter.SetHostInterface (name);
+            break;
+        }
+        default:
+            break;
+    }
+
+    /* Save common settings */
+    mAdapter.SetMACAddress (property ("MAC_Address").toString());
+}
+
+void VBoxVMSettingsNetworkDetails::loadList (KNetworkAttachmentType aType,
+                                             const QStringList &aList)
+{
+    mType = aType;
+
+    /* Setup visibility for alternate widgets */
+    mLsHost->setVisible (mType != KNetworkAttachmentType_Null);
+    mLbNAT->setVisible (mType == KNetworkAttachmentType_NAT);
+    mCbNAT->setVisible (mType == KNetworkAttachmentType_NAT);
+    mLbBRG->setVisible (mType == KNetworkAttachmentType_Bridged);
+    mCbBRG->setVisible (mType == KNetworkAttachmentType_Bridged);
+    mLbINT->setVisible (mType == KNetworkAttachmentType_Internal);
+    mCbINT->setVisible (mType == KNetworkAttachmentType_Internal);
+    mLbHOI->setVisible (mType == KNetworkAttachmentType_HostOnly);
+    mCbHOI->setVisible (mType == KNetworkAttachmentType_HostOnly);
+    mLbCT->setVisible (mType == KNetworkAttachmentType_HostOnly);
+    mRbAuto->setVisible (mType == KNetworkAttachmentType_HostOnly);
+    mRbManual->setVisible (mType == KNetworkAttachmentType_HostOnly);
+    mLbIPv4->setVisible (mType == KNetworkAttachmentType_HostOnly);
+    mLeIPv4->setVisible (mType == KNetworkAttachmentType_HostOnly);
+    mLbHMv4->setVisible (mType == KNetworkAttachmentType_HostOnly);
+    mLeHMv4->setVisible (mType == KNetworkAttachmentType_HostOnly);
+    mLbIPv6->setVisible (mType == KNetworkAttachmentType_HostOnly);
+    mLeIPv6->setVisible (mType == KNetworkAttachmentType_HostOnly);
+    mLbHMv6->setVisible (mType == KNetworkAttachmentType_HostOnly);
+    mLeHMv6->setVisible (mType == KNetworkAttachmentType_HostOnly);
+#if defined (Q_WS_WIN32)
+    mTbAdd->setVisible (mType == KNetworkAttachmentType_HostOnly);
+    mTbDel->setVisible (mType == KNetworkAttachmentType_HostOnly);
+#endif
+
+    /* Repopulate alternate combo-box with items */
+    if (mType != KNetworkAttachmentType_Null)
+    {
+        comboBox()->clear();
+        populateComboboxes();
+        comboBox()->insertItems (comboBox()->count(), aList);
+        int pos = comboBox()->findText (currentName());
+        comboBox()->setCurrentIndex (pos == -1 ? 0 : pos);
+    }
+
+    /* Reload alternate combo-box dependences */
+    if (mType == KNetworkAttachmentType_HostOnly)
+    {
+        hostOnlyInterfaceChanged();
+        if (property ("HOI_DhcpEnabled").toBool())
+        {
+            mRbAuto->setChecked (true);
+        }
+        else
+        {
+            mRbManual->setChecked (true);
+            QString ipv4 (property ("HOI_IPv4Addr").toString());
+            if (!ipv4.isEmpty() && ipv4 != mLeIPv4->text())
+                mLeIPv4->setText (ipv4);
+            QString nmv4 (property ("HOI_IPv4Mask").toString());
+            if (!nmv4.isEmpty() && nmv4 != mLeHMv4->text())
+                mLeHMv4->setText (nmv4);
+            if (property ("HOI_IPv6Supported").toBool())
+            {
+                QString ipv6 (property ("HOI_IPv6Addr").toString());
+                if (!ipv6.isEmpty() && ipv6 != mLeIPv6->text())
+                    mLeIPv6->setText (ipv6);
+                QString nmv6 (property ("HOI_IPv6Mask").toString());
+                if (!nmv6.isEmpty() && nmv6 != mLeHMv6->text())
+                    mLeHMv6->setText (nmv6);
+            }
+        }
+    }
+
+    /* Load common settings */
+    mLeMAC->setText (property ("MAC_Address").toString());
+
+    /* Applying language settings */
+    retranslateUi();
+}
+
+bool VBoxVMSettingsNetworkDetails::revalidate (KNetworkAttachmentType aType, QString &aWarning)
+{
+    switch (aType)
+    {
+        case KNetworkAttachmentType_NAT:
+            if (currentName (aType).isNull())
+            {
+                aWarning = tr ("no NAT name is specified");
+                return false;
+            }
+            break;
+        case KNetworkAttachmentType_Bridged:
+            if (currentName (aType).isNull())
+            {
+                aWarning = tr ("no bridged network adapter is selected");
+                return false;
+            }
+            break;
+        case KNetworkAttachmentType_Internal:
+            if (currentName (aType).isNull())
+            {
+                aWarning = tr ("no internal network name is specified");
+                return false;
+            }
+            break;
+        case KNetworkAttachmentType_HostOnly:
+            if (currentName (aType).isNull())
+            {
+                aWarning = tr ("no host-only interface is selected");
+                return false;
+            }
+            else if (!property ("HOI_DhcpEnabled").toBool())
+            {
+                if (property ("HOI_IPv4Addr").toString().isEmpty() ||
+                    QHostAddress (property ("HOI_IPv4Addr").toString()).protocol()
+                    != QAbstractSocket::IPv4Protocol)
+                {
+                    aWarning = tr ("host IPv4 address is wrong");
+                    return false;
+                }
+                if (property ("HOI_IPv4Mask").toString().isEmpty() ||
+                    QHostAddress (property ("HOI_IPv4Mask").toString()).protocol()
+                    != QAbstractSocket::IPv4Protocol)
+                {
+                    aWarning = tr ("host IPv4 network mask is wrong");
+                    return false;
+                }
+                if (property ("HOI_IPv6Supported").toBool())
+                {
+                    if (property ("HOI_IPv6Addr").toString().isEmpty() ||
+                        QHostAddress (property ("HOI_IPv6Addr").toString()).protocol()
+                        != QAbstractSocket::IPv6Protocol)
+                    {
+                        aWarning = tr ("host IPv6 address is wrong");
+                        return false;
+                    }
+                }
+            }
+            break;
+        default:
+            break;
+    }
+    return true;
+}
+
+QString VBoxVMSettingsNetworkDetails::currentName (KNetworkAttachmentType aType) const
+{
+    if (aType == KNetworkAttachmentType_Null)
+        aType = mType;
+
+    QString result;
+    switch (aType)
+    {
+        case KNetworkAttachmentType_NAT:
+            result = property ("NAT_Name").toString();
+            break;
+        case KNetworkAttachmentType_Bridged:
+            result = property ("BRG_Name").toString();
+            break;
+        case KNetworkAttachmentType_Internal:
+            result = property ("INT_Name").toString();
+            break;
+        case KNetworkAttachmentType_HostOnly:
+            result = property ("HOI_Name").toString();
+            break;
+        default:
+            break;
+    }
+    return result.isEmpty() ? QString::null : result;
+}
+
+void VBoxVMSettingsNetworkDetails::retranslateUi()
+{
+    /* Translate uic generated strings */
+    Ui::VBoxVMSettingsNetworkDetails::retranslateUi (this);
+
+    /* Translate window title */
+    switch (mType)
+    {
+        case KNetworkAttachmentType_Null:
+            setWindowTitle (tr ("Basic Details"));
+            break;
+        case KNetworkAttachmentType_NAT:
+            setWindowTitle (tr ("NAT Details"));
+            break;
+        case KNetworkAttachmentType_Bridged:
+            setWindowTitle (tr ("Bridged Network Details"));
+            break;
+        case KNetworkAttachmentType_Internal:
+            setWindowTitle (tr ("Internal Network Details"));
+            break;
+        case KNetworkAttachmentType_HostOnly:
+            setWindowTitle (tr ("Host-only Network Details"));
+            break;
+    }
+
+    /* Translate empty items */
+    mNotSelected = tr ("Not Selected");
+    populateComboboxes();
+}
+
+void VBoxVMSettingsNetworkDetails::showEvent (QShowEvent *aEvent)
+{
+    /* Update full layout system of message window */
+    QList <QLayout*> layouts = findChildren <QLayout*> ();
+    foreach (QLayout *item, layouts)
+    {
+        item->update();
+        item->activate();
+    }
+    qApp->processEvents();
+
+    /* Now resize window to minimum possible size */
+    resize (minimumSizeHint());
+    qApp->processEvents();
+    setFixedSize (minimumSizeHint());
+
+    /* Centering widget */
+    VBoxGlobal::centerWidget (this, parentWidget(), false);
+
+    QIDialog::showEvent (aEvent);
+}
+
+void VBoxVMSettingsNetworkDetails::accept()
+{
+    /* Save temporary attributes as dynamic properties */
+    setProperty ("NAT_Name",
+                 QVariant (mCbNAT->itemData (mCbNAT->currentIndex()).toString() == QString (emptyItemCode) &&
+                           mCbNAT->currentText() == mCbNAT->itemText (mCbNAT->currentIndex()) ?
+                           QString::null : mCbNAT->currentText()));
+
+    setProperty ("BRG_Name",
+                 QVariant (mCbBRG->itemData (mCbBRG->currentIndex()).toString() == QString (emptyItemCode) ?
+                           QString::null : mCbBRG->currentText()));
+
+    setProperty ("INT_Name",
+                 QVariant (mCbINT->itemData (mCbINT->currentIndex()).toString() == QString (emptyItemCode) &&
+                           mCbINT->currentText() == mCbINT->itemText (mCbINT->currentIndex()) ?
+                           QString::null : mCbINT->currentText()));
+
+    setProperty ("HOI_Name",
+                 QVariant (mCbHOI->itemData (mCbHOI->currentIndex()).toString() == QString (emptyItemCode) ?
+                           QString::null : mCbHOI->currentText()));
+    setProperty ("HOI_DhcpEnabled", QVariant (mRbAuto->isChecked()));
+    setProperty ("HOI_IPv6Supported", QVariant (mLeIPv6->isEnabled()));
+    setProperty ("HOI_IPv4Addr", QVariant (mLeIPv4->text()));
+    setProperty ("HOI_IPv4Mask", QVariant (mLeHMv4->text()));
+    setProperty ("HOI_IPv6Addr", QVariant (mLeIPv6->text()));
+    setProperty ("HOI_IPv6Mask", QVariant (mLeHMv6->text()));
+
+    setProperty ("MAC_Address", QVariant (mLeMAC->text()));
+
+    QIDialog::accept();
+}
+
+void VBoxVMSettingsNetworkDetails::hostOnlyInterfaceChanged()
+{
+    CHostNetworkInterface iface =
+        vboxGlobal().virtualBox().GetHost().FindHostNetworkInterfaceByName (mCbHOI->currentText());
+
+    bool isValid = !iface.isNull() &&
+                   iface.GetInterfaceType() == KHostNetworkInterfaceType_HostOnly;
+    bool isManual = isValid && !iface.GetDhcpEnabled();
+
+    mLbCT->setEnabled (isValid);
+    mRbAuto->setEnabled (isValid);
+    mRbManual->setEnabled (isValid);
+
+    if (isManual)
+    {
+        mRbManual->blockSignals (true);
+        mRbManual->setChecked (true);
+        mRbManual->blockSignals (false);
+    }
+    else
+    {
+        mRbAuto->blockSignals (true);
+        mRbAuto->setChecked (true);
+        mRbAuto->blockSignals (false);
+    }
+    hostOnlyDHCPChanged();
+
+#if defined (Q_WS_WIN32)
+    mTbDel->setEnabled (isValid);
+#endif
+}
+
+void VBoxVMSettingsNetworkDetails::hostOnlyDHCPChanged()
+{
+    CHostNetworkInterface iface =
+        vboxGlobal().virtualBox().GetHost().FindHostNetworkInterfaceByName (mCbHOI->currentText());
+
+    bool isManual = !iface.isNull() &&
+                    iface.GetInterfaceType() == KHostNetworkInterfaceType_HostOnly &&
+                    mRbManual->isChecked();
+    bool isIPv6Supported = isManual && iface.GetIPV6Supported();
+
+    mLeIPv4->clear();
+    mLeHMv4->clear();
+    mLeIPv6->clear();
+    mLeHMv6->clear();
+
+    mLbIPv4->setEnabled (isManual);
+    mLbHMv4->setEnabled (isManual);
+    mLeIPv4->setEnabled (isManual);
+    mLeHMv4->setEnabled (isManual);
+    mLbIPv6->setEnabled (isIPv6Supported);
+    mLbHMv6->setEnabled (isIPv6Supported);
+    mLeIPv6->setEnabled (isIPv6Supported);
+    mLeHMv6->setEnabled (isIPv6Supported);
+
+    if (isManual)
+    {
+        mLeIPv4->setText (iface.GetIPAddress());
+        mLeHMv4->setText (iface.GetNetworkMask());
+
+        if (isIPv6Supported)
+        {
+            mLeIPv6->setText (iface.GetIPV6Address());
+            mLeHMv6->setText (QString::number (iface.GetIPV6NetworkMaskPrefixLength()));
+        }
+    }
+}
+
+void VBoxVMSettingsNetworkDetails::genMACClicked()
+{
+    mAdapter.SetMACAddress (QString::null);
+    mLeMAC->setText (mAdapter.GetMACAddress());
+}
+
+#if defined (Q_WS_WIN32)
+void VBoxVMSettingsNetworkDetails::addInterface()
+{
+    /* Allow the started helper process to make itself the foreground window */
+    AllowSetForegroundWindow (ASFW_ANY);
+
+    /* Creating interface */
+    CHost host = vboxGlobal().virtualBox().GetHost();
+    CHostNetworkInterface iface;
+    CProgress progress = host.CreateHostOnlyNetworkInterface (iface);
+    if (host.isOk())
+    {
+        vboxProblem().showModalProgressDialog (progress,
+            tr ("Performing", "creating/removing host-only interface"), this);
+        if (progress.GetResultCode() == 0)
+        {
+            mCbHOI->insertItem (mCbHOI->count(), iface.GetName());
+            mCbHOI->setCurrentIndex (mCbHOI->count() - 1);
+        }
+        else
+            vboxProblem().cannotCreateHostInterface (progress, this);
+    }
+    else
+        vboxProblem().cannotCreateHostInterface (host, this);
+
+    /* Allow the started helper process to make itself the foreground window */
+    AllowSetForegroundWindow (ASFW_ANY);
+}
+
+void VBoxVMSettingsNetworkDetails::delInterface()
+{
+    /* Allow the started helper process to make itself the foreground window */
+    AllowSetForegroundWindow (ASFW_ANY);
+
+    Assert (mCbHOI->itemData (mCbHOI->currentIndex()).toString()
+            != QString (emptyItemCode));
+
+    /* Check interface name */
+    QString name (mCbHOI->currentText());
+
+    /* Asking user about deleting selected network interface */
+    int delNetIface = vboxProblem().confirmDeletingHostInterface (name, this);
+    if (delNetIface == QIMessageBox::Cancel) return;
+
+    /* Removing interface */
+    CHost host = vboxGlobal().virtualBox().GetHost();
+    CHostNetworkInterface iface = host.FindHostNetworkInterfaceByName (name);
+    if (!iface.isNull())
+    {
+        /* Delete interface */
+        CProgress progress = host.RemoveHostOnlyNetworkInterface (iface.GetId(), iface);
+        if (host.isOk())
+        {
+            vboxProblem().showModalProgressDialog (progress,
+                tr ("Performing", "creating/removing host-only interface"), this);
+            if (progress.GetResultCode() == 0)
+            {
+                int pos = mCbHOI->findText (name);
+                Assert (pos != -1);
+                mCbHOI->removeItem (pos);
+            }
+            else
+                vboxProblem().cannotRemoveHostInterface (progress, iface, this);
+        }
+    }
+    if (!host.isOk())
+        vboxProblem().cannotRemoveHostInterface (host, iface, this);
+
+    /* Allow the started helper process to make itself the foreground window */
+    AllowSetForegroundWindow (ASFW_ANY);
+}
+#endif
+
+void VBoxVMSettingsNetworkDetails::populateComboboxes()
+{
+    /* Append || retranslate <Not Selected> item */
+    QList <QComboBox*> list;
+    list << mCbNAT << mCbBRG << mCbINT << mCbHOI;
+
+    foreach (QComboBox *cb, list)
+    {
+        int pos = cb->findData (emptyItemCode);
+        if (pos == -1)
+            cb->insertItem (0, mNotSelected, emptyItemCode);
+        else
+            cb->setItemText (pos, mNotSelected);
+    }
+}
+
+QComboBox* VBoxVMSettingsNetworkDetails::comboBox() const
+{
+    switch (mType)
+    {
+        case KNetworkAttachmentType_NAT:
+            return mCbNAT;
+        case KNetworkAttachmentType_Bridged:
+            return mCbBRG;
+        case KNetworkAttachmentType_Internal:
+            return mCbINT;
+        case KNetworkAttachmentType_HostOnly:
+            return mCbHOI;
+        default:
+            break;
+    }
+    return 0;
+}
+
Index: trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsNetworkDetails.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsNetworkDetails.ui	(revision 17788)
+++ trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsNetworkDetails.ui	(revision 17788)
@@ -0,0 +1,430 @@
+<ui version="4.0" >
+ <comment>
+ VBox frontends: Qt4 GUI ("VirtualBox"):
+
+ Copyright (C) 2008 Sun Microsystems, Inc.
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License (GPL) as published by the Free Software
+ Foundation, in version 2 as it comes in the "COPYING" file of the
+ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+ Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ Clara, CA 95054 USA or visit http://www.sun.com if you need
+ additional information or have any questions.
+ </comment>
+ <class>VBoxVMSettingsNetworkDetails</class>
+ <widget class="QWidget" name="VBoxVMSettingsNetworkDetails" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>402</width>
+    <height>255</height>
+   </rect>
+  </property>
+  <layout class="QGridLayout" >
+   <item row="0" column="0" colspan="5" >
+    <widget class="QILabelSeparator" name="mLsHost" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text" >
+      <string>Host Settings</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1" >
+    <widget class="QLabel" name="mLbNAT" >
+     <property name="text" >
+      <string>&amp;NAT Network:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="buddy" >
+      <cstring>mCbNAT</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="2" colspan="3" >
+    <widget class="QComboBox" name="mCbNAT" >
+     <property name="toolTip" >
+      <string>Displays the name of the NAT network selected for this adapter.</string>
+     </property>
+     <property name="editable" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1" >
+    <widget class="QLabel" name="mLbBRG" >
+     <property name="text" >
+      <string>&amp;Bridged Network Adapter:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="buddy" >
+      <cstring>mCbBRG</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="2" colspan="3" >
+    <widget class="QComboBox" name="mCbBRG" >
+     <property name="toolTip" >
+      <string>Displays the name of the host network adapter selected for bridged networking.</string>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="1" >
+    <widget class="QLabel" name="mLbINT" >
+     <property name="text" >
+      <string>Internal &amp;Network:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="buddy" >
+      <cstring>mCbINT</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="2" colspan="3" >
+    <widget class="QComboBox" name="mCbINT" >
+     <property name="toolTip" >
+      <string>Displays the name of the internal network selected for this adapter.</string>
+     </property>
+     <property name="editable" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="1" >
+    <widget class="QLabel" name="mLbHOI" >
+     <property name="text" >
+      <string>Host-only &amp;Network Interface:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="buddy" >
+      <cstring>mCbHOI</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="2" colspan="3" >
+    <layout class="QHBoxLayout" >
+     <item>
+      <widget class="QComboBox" name="mCbHOI" >
+       <property name="toolTip" >
+        <string>Displays the name of the VirtualBox network interface selected for host-only networking.</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QToolButton" name="mTbAdd" >
+       <property name="toolTip" >
+        <string>Add new VirtualBox host-only network interface.</string>
+       </property>
+       <property name="autoRaise" >
+        <bool>true</bool>
+       </property>
+       <property name="visible" >
+        <bool>false</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QToolButton" name="mTbDel" >
+       <property name="toolTip" >
+        <string>Remove selected VirtualBox host-only network interface.</string>
+       </property>
+       <property name="autoRaise" >
+        <bool>true</bool>
+       </property>
+       <property name="visible" >
+        <bool>false</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item row="5" column="1" >
+    <widget class="QLabel" name="mLbCT" >
+     <property name="text" >
+      <string>Configuration Type:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="2" colspan="3" >
+    <widget class="QRadioButton" name="mRbAuto" >
+     <property name="toolTip" >
+      <string>Use DHCP automatic configuration for this host-only network interface.</string>
+     </property>
+     <property name="text" >
+      <string>&amp;DHCP Automatic Configuration</string>
+     </property>
+    </widget>
+   </item>
+   <item row="6" column="2" colspan="3" >
+    <widget class="QRadioButton" name="mRbManual" >
+     <property name="toolTip" >
+      <string>Use manual configuration for this host-only network interface.</string>
+     </property>
+     <property name="text" >
+      <string>M&amp;anual Configuration</string>
+     </property>
+    </widget>
+   </item>
+   <item row="7" column="1" >
+    <widget class="QLabel" name="mLbIPv4" >
+     <property name="text" >
+      <string>&amp;Host IPv4 Address:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="buddy" >
+      <cstring>mLeIPv4</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="7" column="2" colspan="3" >
+    <widget class="QLineEdit" name="mLeIPv4" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="toolTip" >
+      <string>Displays the host IPv4 address for this interface.</string>
+     </property>
+    </widget>
+   </item>
+   <item row="8" column="1" >
+    <widget class="QLabel" name="mLbHMv4" >
+     <property name="text" >
+      <string>H&amp;ost IPv4 Network Mask:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="buddy" >
+      <cstring>mLeHMv4</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="8" column="2" colspan="3" >
+    <widget class="QLineEdit" name="mLeHMv4" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="toolTip" >
+      <string>Displays the host IPv4 network mask for this interface.</string>
+     </property>
+    </widget>
+   </item>
+   <item row="9" column="1" >
+    <widget class="QLabel" name="mLbIPv6" >
+     <property name="text" >
+      <string>Ho&amp;st IPv6 Address:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="buddy" >
+      <cstring>mLeIPv6</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="9" column="2" colspan="3" >
+    <widget class="QLineEdit" name="mLeIPv6" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="toolTip" >
+      <string>Displays the host IPv6 address for this interface if IPv6 protocol is supported.</string>
+     </property>
+    </widget>
+   </item>
+   <item row="10" column="1" >
+    <widget class="QLabel" name="mLbHMv6" >
+     <property name="text" >
+      <string>Hos&amp;t IPv6 Network Mask Length:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="buddy" >
+      <cstring>mLeHMv6</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="10" column="2" colspan="3" >
+    <widget class="QLineEdit" name="mLeHMv6" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="toolTip" >
+      <string>Displays the host IPv6 network mask prefix length for this interface if IPv6 protocol is supported.</string>
+     </property>
+    </widget>
+   </item>
+   <item row="11" column="0" colspan="5" >
+    <widget class="QILabelSeparator" name="mLsHost" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text" >
+      <string>Guest Settings</string>
+     </property>
+    </widget>
+   </item>
+   <item row="12" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Fixed</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="12" column="1" >
+    <widget class="QLabel" name="mLbMAC" >
+     <property name="text" >
+      <string>Guest &amp;MAC Address:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="buddy" >
+      <cstring>mLeMAC</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="12" column="2" colspan="2" >
+    <widget class="QLineEdit" name="mLeMAC" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="toolTip" >
+      <string>Displays the MAC address of this adapter. It contains exactly 12 characters chosen from {0-9,A-F}. Note that the second character must be an even digit.</string>
+     </property>
+    </widget>
+   </item>
+   <item row="12" column="4" >
+    <widget class="QToolButton" name="mTbMAC" >
+     <property name="toolTip" >
+      <string>Generates a new random MAC address.</string>
+     </property>
+     <property name="icon" >
+      <iconset resource="../VirtualBox.qrc" >:/refresh_16px.png</iconset>
+     </property>
+     <property name="autoRaise" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="13" column="0" colspan="5" >
+    <spacer name="verticalSpacer" >
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0" >
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="14" column="0" colspan="5" >
+    <widget class="QIDialogButtonBox" name="mButtonBox" >
+     <property name="standardButtons" >
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QILabelSeparator</class>
+   <extends>QLabel</extends>
+   <header>QILabelSeparator.h</header>
+  </customwidget>
+  <customwidget>
+   <class>QIDialogButtonBox</class>
+   <extends>QDialogButtonBox</extends>
+   <header>QIDialogButtonBox.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>mButtonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>VBoxVMSettingsNetworkDetails</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>162</x>
+     <y>339</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>162</x>
+     <y>179</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>mButtonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>VBoxVMSettingsNetworkDetails</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>162</x>
+     <y>339</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>162</x>
+     <y>179</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
