Index: /trunk/src/VBox/Frontends/VirtualBox/Makefile
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/Makefile	(revision 1627)
+++ /trunk/src/VBox/Frontends/VirtualBox/Makefile	(revision 1628)
@@ -81,4 +81,7 @@
 	ui/VBoxVMSettingsDlg.ui.h \
 	ui/VBoxSharedFoldersSettings.ui.h
+ifeq ($(BUILD_TARGET),win)
+VirtualBox_QT_MOCUIHDRS += ui/VBoxVMNetworkSettings.ui.h
+endif
 
 VirtualBox_GENSRCS = \
Index: /trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui	(revision 1627)
+++ /trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui	(revision 1628)
@@ -27,6 +27,6 @@
             <x>0</x>
             <y>0</y>
-            <width>307</width>
-            <height>312</height>
+            <width>361</width>
+            <height>368</height>
         </rect>
     </property>
@@ -34,5 +34,5 @@
         <string>VBoxVMNetworkSettings</string>
     </property>
-    <grid>
+    <vbox>
         <property name="name">
             <cstring>unnamed</cstring>
@@ -41,5 +41,5 @@
             <number>10</number>
         </property>
-        <widget class="QGroupBox" row="0" column="0">
+        <widget class="QGroupBox">
             <property name="name">
                 <cstring>grbEnabled</cstring>
@@ -219,5 +219,5 @@
                     </property>
                     <property name="flat">
-                        <bool>true</bool>
+                        <bool>false</bool>
                     </property>
                     <vbox>
@@ -225,10 +225,7 @@
                             <cstring>unnamed</cstring>
                         </property>
-                        <property name="margin">
-                            <number>0</number>
-                        </property>
                         <widget class="QLayoutWidget">
                             <property name="name">
-                                <cstring>layout34</cstring>
+                                <cstring>layout33</cstring>
                             </property>
                             <hbox>
@@ -236,4 +233,7 @@
                                     <cstring>unnamed</cstring>
                                 </property>
+                                <property name="spacing">
+                                    <number>0</number>
+                                </property>
                                 <widget class="QFrame">
                                     <property name="name">
@@ -246,5 +246,5 @@
                                         <enum>Raised</enum>
                                     </property>
-                                    <vbox>
+                                    <grid>
                                         <property name="name">
                                             <cstring>unnamed</cstring>
@@ -253,7 +253,10 @@
                                             <number>0</number>
                                         </property>
-                                        <widget class="QLayoutWidget">
-                                            <property name="name">
-                                                <cstring>layout14</cstring>
+                                        <property name="spacing">
+                                            <number>6</number>
+                                        </property>
+                                        <widget class="QLayoutWidget" row="0" column="0">
+                                            <property name="name">
+                                                <cstring>layout31</cstring>
                                             </property>
                                             <hbox>
@@ -284,40 +287,17 @@
                                                         <cstring>leHostInterfaceName</cstring>
                                                     </property>
+                                                    <property name="focusPolicy">
+                                                        <enum>NoFocus</enum>
+                                                    </property>
+                                                    <property name="readOnly">
+                                                        <bool>true</bool>
+                                                    </property>
                                                     <property name="whatsThis" stdset="0">
-                                                        <string>Enter name for the new interface here</string>
-                                                    </property>
-                                                </widget>
-                                                <widget class="QToolButton">
-                                                    <property name="name">
-                                                        <cstring>pbHostAdd</cstring>
-                                                    </property>
-                                                    <property name="text">
-                                                        <string>...</string>
-                                                    </property>
-                                                    <property name="toolTip" stdset="0">
-                                                        <string></string>
-                                                    </property>
-                                                    <property name="whatsThis" stdset="0">
-                                                        <string>Add a new host interface</string>
-                                                    </property>
-                                                </widget>
-                                                <widget class="QToolButton">
-                                                    <property name="name">
-                                                        <cstring>pbHostRemove</cstring>
-                                                    </property>
-                                                    <property name="text">
-                                                        <string>...</string>
-                                                    </property>
-                                                    <property name="toolTip" stdset="0">
-                                                        <string></string>
-                                                    </property>
-                                                    <property name="whatsThis" stdset="0">
-                                                        <string>Remove
-                                                        the selected host interface</string>
+                                                        <string>The name of the interface selected for the current adapter</string>
                                                     </property>
                                                 </widget>
                                             </hbox>
                                         </widget>
-                                        <widget class="QListBox">
+                                        <widget class="QListBox" row="1" column="0">
                                             <property name="name">
                                                 <cstring>lbHostInterface</cstring>
@@ -335,5 +315,96 @@
                                             </property>
                                         </widget>
-                                    </vbox>
+                                        <widget class="QLayoutWidget" row="1" column="1">
+                                            <property name="name">
+                                                <cstring>layout27</cstring>
+                                            </property>
+                                            <vbox>
+                                                <property name="name">
+                                                    <cstring>unnamed</cstring>
+                                                </property>
+                                                <property name="margin">
+                                                    <number>0</number>
+                                                </property>
+                                                <property name="spacing">
+                                                    <number>0</number>
+                                                </property>
+                                                <widget class="QToolButton">
+                                                    <property name="name">
+                                                        <cstring>pbHostAdd</cstring>
+                                                    </property>
+                                                    <property name="focusPolicy">
+                                                        <enum>StrongFocus</enum>
+                                                    </property>
+                                                    <property name="text">
+                                                        <string>...</string>
+                                                    </property>
+                                                    <property name="autoRaise">
+                                                        <bool>true</bool>
+                                                    </property>
+                                                    <property name="toolTip" stdset="0">
+                                                        <string></string>
+                                                    </property>
+                                                    <property name="whatsThis" stdset="0">
+                                                        <string>Add a new host interface</string>
+                                                    </property>
+                                                </widget>
+                                                <widget class="QToolButton">
+                                                    <property name="name">
+                                                        <cstring>pbHostRemove</cstring>
+                                                    </property>
+                                                    <property name="focusPolicy">
+                                                        <enum>StrongFocus</enum>
+                                                    </property>
+                                                    <property name="text">
+                                                        <string>...</string>
+                                                    </property>
+                                                    <property name="autoRaise">
+                                                        <bool>true</bool>
+                                                    </property>
+                                                    <property name="toolTip" stdset="0">
+                                                        <string></string>
+                                                    </property>
+                                                    <property name="whatsThis" stdset="0">
+                                                        <string>Remove
+                                                        the selected host interface</string>
+                                                    </property>
+                                                </widget>
+                                                <spacer>
+                                                    <property name="name">
+                                                        <cstring>spacer7</cstring>
+                                                    </property>
+                                                    <property name="orientation">
+                                                        <enum>Vertical</enum>
+                                                    </property>
+                                                    <property name="sizeType">
+                                                        <enum>Expanding</enum>
+                                                    </property>
+                                                    <property name="sizeHint">
+                                                        <size>
+                                                            <width>10</width>
+                                                            <height>10</height>
+                                                        </size>
+                                                    </property>
+                                                </spacer>
+                                            </vbox>
+                                        </widget>
+                                        <spacer row="0" column="1">
+                                            <property name="name">
+                                                <cstring>spacer11</cstring>
+                                            </property>
+                                            <property name="orientation">
+                                                <enum>Horizontal</enum>
+                                            </property>
+                                            <property name="sizeType">
+                                                <enum>Minimum</enum>
+                                            </property>
+                                            <property name="sizeHint">
+                                                <size>
+                                                    <width>20</width>
+                                                    <height>20</height>
+                                                </size>
+                                            </property>
+                                        </spacer>
+                                    </grid>
                                 </widget>
                                 <widget class="QLayoutWidget">
@@ -639,5 +710,5 @@
             </vbox>
         </widget>
-    </grid>
+    </vbox>
 </widget>
 <connections>
@@ -690,12 +761,17 @@
     <include location="global" impldecl="in implementation">qfiledialog.h</include>
     <include location="local" impldecl="in declaration">COMDefs.h</include>
+    <include location="local" impldecl="in declaration">QIWidgetValidator.h</include>
     <include location="local" impldecl="in implementation">VBoxGlobal.h</include>
     <include location="local" impldecl="in implementation">VBoxProblemReporter.h</include>
 </includes>
 <variables>
-    <variable access="private">QStringList networkInterfaceList;</variable>
     <variable access="private">CNetworkAdapter cadapter;</variable>
-    <variable access="private">QString NoSuitableIfaces;</variable>
+    <variable access="private">int mInterfaceNumber;</variable>
+    <variable access="private">QIWidgetValidator *mWalidator;</variable>
+    <variable access="private">QString mNoInterfaces;</variable>
 </variables>
+<signals>
+	<signal>listChanged( QWidget* )</signal>
+</signals>
 <slots>
     <slot>cbNetworkAttachment_activated( const QString &amp; string )</slot>
@@ -703,14 +779,19 @@
     <slot>pbTAPSetup_clicked()</slot>
     <slot>pbTAPTerminate_clicked()</slot>
-    <slot access="protected">hostInterfaceAdd()</slot>
+	<slot access="protected">hostInterfaceAdd()</slot>
     <slot access="protected">hostInterfaceRemove()</slot>
     <slot access="protected">lbHostInterface_highlighted( QListBoxItem* item )</slot>
+    <slot access="protected">grbEnabledToggled( bool )</slot>
 </slots>
 <functions>
     <function access="private" specifier="non virtual">init()</function>
-    <function>getFromAdapter( const CNetworkAdapter &amp; adapter )</function>
+    <function>loadList( const QStringList &amp; )</function>
+    <function>getFromAdapter( const CNetworkAdapter &amp; )</function>
     <function>putBackToAdapter()</function>
-    <function access="private">updateInterfaceList()</function>
-    <function returnType="bool">checkNetworkInterface( QString input )</function>
+    <function>setValidator( QIWidgetValidator* )</function>
+    <function>revalidate()</function>
+    <function returnType="bool">isPageValid( const QStringList &amp; )</function>
+    <function access="private">selectListItem( const QString &amp; )</function>
+    <function access="private" returnType="bool">isInterfaceInvalid( const QStringList &amp;, const QString &amp; )</function>
 </functions>
 <pixmapinproject/>
Index: /trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h	(revision 1627)
+++ /trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h	(revision 1628)
@@ -30,24 +30,83 @@
 *****************************************************************************/
 
+/**
+ *  QDialog class reimplementation to use for adding network interface.
+ *  It has one line-edit field for entering network interface's name and
+ *  common dialog's ok/cancel buttons.
+ */
+#if defined Q_WS_WIN
+class VBoxAddNIDialog : public QDialog
+{
+    Q_OBJECT
+
+public:
+
+    VBoxAddNIDialog (QWidget *aParent, const QString &aIfaceName) :
+        QDialog (aParent, "VBoxAddNIDialog", true /* modal */),
+        mLeName (0)
+    {
+        setCaption (tr ("Add Host Interface"));
+        QVBoxLayout *mainLayout = new QVBoxLayout (this, 10, 10, "mainLayout");
+
+        /* Setup Input layout */
+        QHBoxLayout *inputLayout = new QHBoxLayout (mainLayout, 10, "inputLayout");
+        QLabel *lbName = new QLabel ("Interface Name", this);
+        mLeName = new QLineEdit (aIfaceName, this);
+        QWhatsThis::add (mLeName, tr ("Enter name for the interface to be created"));
+        inputLayout->addWidget (lbName);
+        inputLayout->addWidget (mLeName);
+        connect (mLeName, SIGNAL (textChanged (const QString &)),
+                 this, SLOT (validate()));
+
+        /* Setup Button layout */
+        QHBoxLayout *buttonLayout = new QHBoxLayout (mainLayout, 10, "buttonLayout");
+        mBtOk = new QPushButton ("OK", this, "btOk");
+        QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
+        QPushButton *btCancel = new QPushButton ("Cancel", this, "btCancel");
+        connect (mBtOk, SIGNAL (clicked()), this, SLOT (accept()));
+        connect (btCancel, SIGNAL (clicked()), this, SLOT (reject()));
+        buttonLayout->addWidget (mBtOk);
+        buttonLayout->addItem (spacer);
+        buttonLayout->addWidget (btCancel);
+
+        /* Validate interface name field */
+        validate();
+    }
+
+    ~VBoxAddNIDialog() {}
+
+    QString getName() { return mLeName->text(); }
+
+private slots:
+
+    void validate()
+    {
+        mBtOk->setEnabled (!mLeName->text().isEmpty());
+    }
+
+private:
+
+    void showEvent (QShowEvent *aEvent)
+    {
+        setFixedHeight (height());
+        QDialog::showEvent (aEvent);
+    }
+
+    QPushButton *mBtOk;
+    QLineEdit *mLeName;
+};
+#endif
+
+
+/**
+ *  VBoxVMNetworkSettings class to use as network interface setup page.
+ */
 void VBoxVMNetworkSettings::init()
 {
-    /* set initial values
-     * -------------------------------------------------------------------- */
+    mInterfaceNumber = 0;
+    mNoInterfaces = tr ("<No suitable interfaces>");
 
     leMACAddress->setValidator (new QRegExpValidator (QRegExp ("[0-9,A-F]{12,12}"), this));
 
-#if defined Q_WS_X11
-    leTAPDescriptor->setValidator (new QIntValidator (-1, std::numeric_limits <LONG>::max(), this));
-#endif
-
-    /* set initial values
-     * -------------------------------------------------------------------- */
-
-    NoSuitableIfaces = tr ("<No suitable interfaces>");
-
-#if defined Q_WS_WIN
-    updateInterfaceList();
-#endif
-    
     cbNetworkAttachment->insertItem (vboxGlobal().toString (CEnums::NoNetworkAttachment));
     cbNetworkAttachment->insertItem (vboxGlobal().toString (CEnums::NATNetworkAttachment));
@@ -55,18 +114,25 @@
     cbNetworkAttachment->insertItem (vboxGlobal().toString (CEnums::InternalNetworkAttachment));
 
-    grbTAP->setEnabled (false); /* initially disabled */
+#if defined Q_WS_X11
+    leTAPDescriptor->setValidator (new QIntValidator (-1, std::numeric_limits <LONG>::max(), this));
+#else
+    /* hide unavailable settings (TAP setup and terminate apps) */
+    frmTAPSetupTerminate->setHidden (true);
+#endif
 
 #if defined Q_WS_WIN
     /* disable unused interface name UI */
     frmHostInterface_X11->setHidden (true);
-    /* setup iconsets -- qdesigner is not capable... */
+    /* setup iconsets */
     pbHostAdd->setIconSet (VBoxGlobal::iconSet ("add_host_iface_16px.png",
                                                 "add_host_iface_disabled_16px.png"));
     pbHostRemove->setIconSet (VBoxGlobal::iconSet ("remove_host_iface_16px.png",
                                                    "remove_host_iface_disabled_16px.png"));
+    connect (grbEnabled, SIGNAL (toggled (bool)),
+             this, SLOT (grbEnabledToggled (bool)));
 #else
     /* disable unused interface name UI */
     frmHostInterface_WIN->setHidden (true);
-    /* setup iconsets -- qdesigner is not capable... */
+    /* setup iconsets */
     pbTAPSetup->setIconSet (VBoxGlobal::iconSet ("select_file_16px.png",
                                                  "select_file_dis_16px.png"));
@@ -75,9 +141,4 @@
 #endif
 
-#if !defined Q_WS_X11
-    /* hide unavailable settings (TAP setup and terminate apps) */
-    frmTAPSetupTerminate->setHidden (true);
-#endif
-
     /* the TAP file descriptor setting is always invisible -- currently not used
      * (remove the relative code at all? -- just leave for some time...) */
@@ -85,22 +146,35 @@
 }
 
-void VBoxVMNetworkSettings::updateInterfaceList()
-{
-#if defined Q_WS_WIN
-    /* clear lists */
-    networkInterfaceList.clear();
+bool VBoxVMNetworkSettings::isPageValid (const QStringList &aList)
+{
+#if defined Q_WS_WIN
+    CEnums::NetworkAttachmentType type =
+        vboxGlobal().toNetworkAttachmentType (cbNetworkAttachment->currentText());
+
+    return !(type == CEnums::HostInterfaceNetworkAttachment &&
+             isInterfaceInvalid (aList, leHostInterfaceName->text()));
+#else
+    NOREF (aList);
+    return true;
+#endif
+}
+
+void VBoxVMNetworkSettings::loadList (const QStringList &aList)
+{
+#if defined Q_WS_WIN
+    /* save current list item name */
+    QString currentListItemName = leHostInterfaceName->text();
+    /* load current list items */
+    lbHostInterface->clearFocus();
     lbHostInterface->clear();
-    /* read a QStringList of interface names */
-    CHostNetworkInterfaceEnumerator en =
-        vboxGlobal().virtualBox().GetHost().GetNetworkInterfaces().Enumerate();
-    while (en.HasMore())
-        networkInterfaceList += en.GetNext().GetName();
-    /* setup a list of interface names */
-    if (networkInterfaceList.count())
-        lbHostInterface->insertStringList (networkInterfaceList);
+    if (aList.count())
+        lbHostInterface->insertStringList (aList);
     else
-        lbHostInterface->insertItem (NoSuitableIfaces);
+        lbHostInterface->insertItem (mNoInterfaces);
+    selectListItem (currentListItemName);
     /* disable interface delete button */
-    pbHostRemove->setEnabled (!networkInterfaceList.isEmpty());
+    pbHostRemove->setEnabled (!aList.isEmpty());
+#else
+    NOREF (aList);
 #endif
 }
@@ -127,12 +201,5 @@
 
 #if defined Q_WS_WIN
-    if (adapter.GetHostInterface().isEmpty())
-        lbHostInterface->setCurrentItem (0);
-    else
-    {
-        QListBoxItem* adapterNode = lbHostInterface->findItem(adapter.GetHostInterface());
-        if (adapterNode)
-            lbHostInterface->setCurrentItem(adapterNode);
-    }
+    selectListItem (adapter.GetHostInterface());
 #else
     leHostInterface->setText (adapter.GetHostInterface());
@@ -140,5 +207,5 @@
 
 #if defined Q_WS_X11
-    leTAPDescriptor->setText (QString::number(adapter.GetTAPFileDescriptor()));
+    leTAPDescriptor->setText (QString::number (adapter.GetTAPFileDescriptor()));
     leTAPSetup->setText (adapter.GetTAPSetupApplication());
     leTAPTerminate->setText (adapter.GetTAPTerminateApplication());
@@ -194,22 +261,81 @@
 }
 
-void VBoxVMNetworkSettings::cbNetworkAttachment_activated (const QString &string)
-{
-    grbTAP->setEnabled (vboxGlobal().toNetworkAttachmentType (string) ==
-                        CEnums::HostInterfaceNetworkAttachment);
-}
-
-void VBoxVMNetworkSettings::lbHostInterface_highlighted(QListBoxItem* /*item*/)
-{
-    leHostInterfaceName->clear();
-}
-
-bool VBoxVMNetworkSettings::checkNetworkInterface (QString ni)
-{
-#if defined Q_WS_WIN
-    return networkInterfaceList.find (ni) != networkInterfaceList.end() ? 1 : 0;
-#else
-    NOREF(ni);
-    return true;
+void VBoxVMNetworkSettings::setValidator (QIWidgetValidator *aWalidator)
+{
+    mWalidator = aWalidator;
+}
+
+void VBoxVMNetworkSettings::revalidate()
+{
+    mWalidator->revalidate();
+}
+
+void VBoxVMNetworkSettings::grbEnabledToggled (bool aOn)
+{
+#if defined Q_WS_WIN
+    if (!aOn)
+    {
+        lbHostInterface->clearFocus();
+        cbNetworkAttachment->setCurrentItem (0);
+        cbNetworkAttachment_activated (cbNetworkAttachment->currentText());
+        if (lbHostInterface->selectedItem())
+            lbHostInterface->setSelected (lbHostInterface->selectedItem(), false);
+    }
+    if (lbHostInterface->currentItem() != -1)
+        lbHostInterface->setSelected (lbHostInterface->currentItem(), aOn);
+#else
+    NOREF (aOn);
+#endif
+}
+
+void VBoxVMNetworkSettings::selectListItem (const QString &aItemName)
+{
+    if (!aItemName.isEmpty())
+    {
+#if defined Q_WS_WIN
+        leHostInterfaceName->setText (aItemName);
+        QListBoxItem* adapterNode = lbHostInterface->findItem (aItemName);
+        if (adapterNode)
+        {
+            lbHostInterface->setCurrentItem (adapterNode);
+            lbHostInterface->setSelected (adapterNode, true);
+        }
+#endif
+    }
+}
+
+void VBoxVMNetworkSettings::cbNetworkAttachment_activated (const QString &aString)
+{
+#if defined Q_WS_WIN
+    bool enableHostIf = vboxGlobal().toNetworkAttachmentType (aString) ==
+                        CEnums::HostInterfaceNetworkAttachment;
+    txHostInterface_WIN->setEnabled (enableHostIf);
+    leHostInterfaceName->setEnabled (enableHostIf);
+    lbHostInterface_highlighted (lbHostInterface->selectedItem());
+#else
+    NOREF (aString);
+#endif
+}
+
+void VBoxVMNetworkSettings::lbHostInterface_highlighted (QListBoxItem *aItem)
+{
+    if (!aItem) return;
+#if defined Q_WS_WIN
+    leHostInterfaceName->setText (leHostInterfaceName->isEnabled() ?
+                                  aItem->text() : QString::null);
+    if (!lbHostInterface->isSelected (aItem))
+        lbHostInterface->setSelected (aItem, true);
+#endif
+}
+
+bool VBoxVMNetworkSettings::isInterfaceInvalid (const QStringList &aList,
+                                                const QString &aIface)
+{
+#if defined Q_WS_WIN
+    return aList.find (aIface) == aList.end();
+#else
+    NOREF (aList);
+    NOREF (aIface);
+    return false;
 #endif
 }
@@ -223,11 +349,4 @@
 void VBoxVMNetworkSettings::pbTAPSetup_clicked()
 {
-//    QFileDialog dlg ("/", QString::null, this);
-//    dlg.setMode (QFileDialog::ExistingFile);
-//    dlg.setViewMode (QFileDialog::List);
-//    dlg.setCaption (tr ("Select TAP setup application"));
-//    if (dlg.exec() == QDialog::Accepted)
-//        leTAPSetup->setText (dlg.selectedFile());
-
     QString selected = QFileDialog::getOpenFileName (
         "/",
@@ -243,11 +362,4 @@
 void VBoxVMNetworkSettings::pbTAPTerminate_clicked()
 {
-//    QFileDialog dlg ("/", QString::null, this);
-//    dlg.setMode (QFileDialog::ExistingFile);
-//    dlg.setViewMode (QFileDialog::List);
-//    dlg.setCaption (tr ("Select TAP terminate application"));
-//    if (dlg.exec() == QDialog::Accepted)
-//        leTAPTerminate->setText (dlg.selectedFile());
-
     QString selected = QFileDialog::getOpenFileName (
         "/",
@@ -268,12 +380,11 @@
     AllowSetForegroundWindow (ASFW_ANY);
 
-    /* check interface name */
-    QString iName = leHostInterfaceName->text();
-    if (iName.isEmpty() || iName == NoSuitableIfaces)
-    {
-        vboxProblem().message (this, VBoxProblemReporter::Error, 
-            tr ("Host network interface name cannot be empty"));
+    /* creating add host interface dialog */
+    VBoxAddNIDialog dlg (this, lbHostInterface->currentItem() != -1 ?
+                         tr ("Host Interface %1").arg (++mInterfaceNumber) :
+                         leHostInterfaceName->text());
+    if (dlg.exec() != QDialog::Accepted)
         return;
-    }
+    QString iName = dlg.getName();
 
     /* create interface */
@@ -286,16 +397,12 @@
         if (progress.GetResultCode() == 0)
         {
-            updateInterfaceList();
-            /* move the selection to the new created item */
-            QListBoxItem *createdNode =
-                lbHostInterface->findItem (leHostInterfaceName->text());
-            if (createdNode)
-                lbHostInterface->setCurrentItem (createdNode);
-            else
-                lbHostInterface->setCurrentItem (0);
+            /* add&select newly created created interface */
+            delete lbHostInterface->findItem (mNoInterfaces);
+            lbHostInterface->insertItem (iName);
+            selectListItem (iName);
+            emit listChanged (this);
         }
         else
             vboxProblem().cannotCreateHostInterface (progress, iName, this);
-
     }
     else
@@ -320,4 +427,17 @@
         return;
 
+    /* asking user about deleting selected network interface */
+    int delNetIface = vboxProblem().message (this, VBoxProblemReporter::Question,
+        tr ("<p>Do you want to remove selected network interface "
+            "<nobr><b>%1</b>?</nobr></p>"
+            "<p>If this interface is currently selected you should "
+            "apply VM settings changes to avoid VM using of non-existing "
+            "interface</p>").arg (iName),
+        0, /* autoConfirmId */
+        QIMessageBox::Ok | QIMessageBox::Default,
+        QIMessageBox::Cancel | QIMessageBox::Escape);
+    if (delNetIface == QIMessageBox::Cancel)
+        return;
+
     CHost host = vboxGlobal().virtualBox().GetHost();
     CHostNetworkInterface iFace = host.GetNetworkInterfaces().FindByName (iName);
@@ -325,5 +445,5 @@
     {
         /* delete interface */
-         CProgress progress = host.RemoveHostNetworkInterface (iFace.GetId(), iFace);
+        CProgress progress = host.RemoveHostNetworkInterface (iFace.GetId(), iFace);
         if (host.isOk())
         {
@@ -331,8 +451,8 @@
             if (progress.GetResultCode() == 0)
             {
-                updateInterfaceList();
-                /* move the selection to the start of the list */
-                lbHostInterface->setCurrentItem(0);
-                lbHostInterface->setSelected(0, true);
+                if (lbHostInterface->count() == 1)
+                    lbHostInterface->insertItem (mNoInterfaces);
+                delete lbHostInterface->findItem (iName);
+                emit listChanged (this);
             }
             else
@@ -345,2 +465,6 @@
 #endif
 }
+
+#if defined Q_WS_WIN
+#include "VBoxVMNetworkSettings.ui.moc"
+#endif
Index: /trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui	(revision 1627)
+++ /trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui	(revision 1628)
@@ -2663,5 +2663,5 @@
     <variable access="private">QValueVector &lt; CHostFloppyDrive &gt; hostFloppies;</variable>
     <variable access="private">CMachine cmachine;</variable>
-    <variable access="private">QStringList bootDevicesInUse;</variable>
+    <variable access="private">QStringList mInterfaceList;</variable>
     <variable access="private">QWidgetStack *wstUSBFilters;</variable>
     <variable access="private">ulong mLastUSBFilterNum;</variable>
@@ -2690,5 +2690,5 @@
     <slot>showImageManagerISOFloppy()</slot>
     <slot>showVDImageManager( QUuid *id, VBoxMediaComboBox *le, QLabel *tx = NULL )</slot>
-    <slot>addNetworkAdapter( const CNetworkAdapter &amp; adapter, bool select )</slot>
+    <slot>addNetworkAdapter( const CNetworkAdapter &amp; adapter )</slot>
     <slot>slRAM_valueChanged( int val )</slot>
     <slot>leRAM_textChanged( const QString &amp; text )</slot>
@@ -2713,4 +2713,6 @@
     <slot>fdMediaChanged()</slot>
     <slot>processAdjustSize()</slot>
+    <slot>updateInterfaces( QWidget* )</slot>
+    <slot>networkPageUpdate( QWidget* )</slot>
 </slots>
 <functions>
@@ -2718,10 +2720,10 @@
     <function>setup( const QString &amp;, const QString &amp; )</function>
     <function>getFromMachine( const CMachine &amp; machine )</function>
+    <function returnType="bool">eventFilter( QObject * watched, QEvent * e )</function>
     <function returnType="COMResult">putBackToMachine()</function>
-    <function access="protected">setWarning( const QString &amp; )</function>
-    <function access="protected">showEvent( QShowEvent * )</function>
-    <function returnType="bool">eventFilter( QObject * watched, QEvent * e )</function>
-    <function access="protected">updateShortcuts()</function>
-    <function access="protected" returnType="QString">getHdInfo( QGroupBox*, QUuid )</function>
+    <function access="private">setWarning( const QString &amp; )</function>
+    <function access="private">showEvent( QShowEvent * )</function>
+    <function access="private">updateShortcuts()</function>
+    <function access="private" returnType="QString">getHdInfo( QGroupBox*, QUuid )</function>
 </functions>
 <pixmapinproject/>
Index: /trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h	(revision 1627)
+++ /trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h	(revision 1628)
@@ -721,4 +721,6 @@
     /* Network Page */
 
+    updateInterfaces (0);
+
     /*
      *  update the Ok button state for pages with validation
@@ -822,4 +824,36 @@
         cbISOFloppy->refresh();
     }
+}
+
+
+void VBoxVMSettingsDlg::updateInterfaces (QWidget *aWidget)
+{
+#if defined Q_WS_WIN
+    /* clear list */
+    mInterfaceList.clear();
+    /* write a QStringList of interface names */
+    CHostNetworkInterfaceEnumerator en =
+        vboxGlobal().virtualBox().GetHost().GetNetworkInterfaces().Enumerate();
+    while (en.HasMore())
+        mInterfaceList += en.GetNext().GetName();
+    if (aWidget)
+    {
+        VBoxVMNetworkSettings *set = static_cast<VBoxVMNetworkSettings*> (aWidget);
+        set->revalidate();
+    }
+#else
+    NOREF (aWidget);
+#endif
+}
+
+void VBoxVMSettingsDlg::networkPageUpdate (QWidget *aWidget)
+{
+    if (!aWidget) return;
+#if defined Q_WS_WIN
+    updateInterfaces (0);
+    VBoxVMNetworkSettings *set = static_cast<VBoxVMNetworkSettings*> (aWidget);
+    set->loadList (mInterfaceList);
+    set->revalidate();
+#endif
 }
 
@@ -1131,27 +1165,15 @@
     else if (pg == pageNetwork)
     {
-        int slot = -1;
-        for (int index = 0; index < tbwNetwork->count(); index++)
-        {
-            QWidget* pTab = tbwNetwork->page (index);
-            Assert(pTab);
-            VBoxVMNetworkSettings* pNetSet = static_cast <VBoxVMNetworkSettings*>(pTab);
-            if (!pNetSet->grbEnabled->isChecked())
-            {
-                pNetSet->cbNetworkAttachment->setCurrentItem (0);
-                pNetSet->cbNetworkAttachment_activated (pNetSet->cbNetworkAttachment->currentText());
-            }
-
-            CEnums::NetworkAttachmentType type =
-                vboxGlobal().toNetworkAttachmentType (pNetSet->cbNetworkAttachment->currentText());
-            valid = (slot == -1) &&
-                    !(type == CEnums::HostInterfaceNetworkAttachment &&
-                      !pNetSet->checkNetworkInterface (pNetSet->lbHostInterface->currentText()));
-            if (slot == -1 && !valid)
-                slot = index;
+        int index = 0;
+        for (; index < tbwNetwork->count(); ++index)
+        {
+            QWidget *tab = tbwNetwork->page (index);
+            VBoxVMNetworkSettings *set = static_cast<VBoxVMNetworkSettings*> (tab);
+            valid = set->isPageValid (mInterfaceList);
+            if (!valid) break;
         }
         if (!valid)
-            setWarning (tr ("Incorrect host network interface is selected for Adapter %1.")
-                        .arg (slot));
+            setWarning (tr ("Incorrect host network interface is selected "
+                            "for Adapter %1.").arg (index));
     }
     else if (pg == pageVRDP)
@@ -1397,8 +1419,8 @@
     {
         ulong count = vbox.GetSystemProperties().GetNetworkAdapterCount();
-        for (ulong slot = 0; slot < count; slot ++)
+        for (ulong slot = 0; slot < count; ++ slot)
         {
             CNetworkAdapter adapter = machine.GetNetworkAdapter (slot);
-            addNetworkAdapter (adapter, false);
+            addNetworkAdapter (adapter);
         }
     }
@@ -1744,10 +1766,10 @@
 }
 
-void VBoxVMSettingsDlg::addNetworkAdapter (const CNetworkAdapter &adapter,
-                                           bool /* select */)
-{
-    VBoxVMNetworkSettings *page = new VBoxVMNetworkSettings ();
-    page->getFromAdapter (adapter);
-    tbwNetwork->addTab(page, QString("Adapter %1").arg(adapter.GetSlot()));
+void VBoxVMSettingsDlg::addNetworkAdapter (const CNetworkAdapter &aAdapter)
+{
+    VBoxVMNetworkSettings *page = new VBoxVMNetworkSettings();
+    page->loadList (mInterfaceList);
+    page->getFromAdapter (aAdapter);
+    tbwNetwork->addTab (page, QString ("Adapter %1").arg (aAdapter.GetSlot()));
 
     /* fix the tab order so that main dialog's buttons are always the last */
@@ -1758,15 +1780,16 @@
     /* setup validation */
     QIWidgetValidator *wval = new QIWidgetValidator (pageNetwork, this);
+    connect (page->grbEnabled, SIGNAL (toggled (bool)), wval, SLOT (revalidate()));
     connect (page->cbNetworkAttachment, SIGNAL (activated (const QString &)),
              wval, SLOT (revalidate()));
 
-    connect (page->lbHostInterface, SIGNAL ( selectionChanged () ),
+#if defined Q_WS_WIN
+    connect (page->lbHostInterface, SIGNAL (highlighted (QListBoxItem*)),
              wval, SLOT (revalidate()));
-    connect (page->lbHostInterface, SIGNAL ( currentChanged ( QListBoxItem * ) ),
-             wval, SLOT (revalidate()));
-    connect (page->lbHostInterface, SIGNAL ( highlighted ( QListBoxItem * ) ),
-             wval, SLOT (revalidate()));
-    connect (page->grbEnabled, SIGNAL (toggled (bool)),
-             wval, SLOT (revalidate()));
+    connect (tbwNetwork, SIGNAL (currentChanged (QWidget*)),
+             this, SLOT (networkPageUpdate (QWidget*)));
+    connect (page, SIGNAL (listChanged (QWidget*)),
+             this, SLOT (updateInterfaces (QWidget*)));
+#endif
 
     connect (wval, SIGNAL (validityChanged (const QIWidgetValidator *)),
@@ -1775,5 +1798,6 @@
              this, SLOT (revalidate( QIWidgetValidator *)));
 
-    wval->revalidate();
+    page->setValidator (wval);
+    page->revalidate();
 }
 
