1 | /**
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * "VM network settings" dialog UI include (Qt Designer)
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License as published by the Free Software Foundation,
|
---|
14 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
15 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
16 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * If you received this file as part of a commercial VirtualBox
|
---|
19 | * distribution, then only the terms of your commercial VirtualBox
|
---|
20 | * license agreement apply instead of the previous paragraph.
|
---|
21 | */
|
---|
22 |
|
---|
23 | /****************************************************************************
|
---|
24 | ** ui.h extension file, included from the uic-generated form implementation.
|
---|
25 | **
|
---|
26 | ** If you wish to add, delete or rename functions or slots use
|
---|
27 | ** Qt Designer which will update this file, preserving your code. Create an
|
---|
28 | ** init() function in place of a constructor, and a destroy() function in
|
---|
29 | ** place of a destructor.
|
---|
30 | *****************************************************************************/
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * QDialog class reimplementation to use for adding network interface.
|
---|
34 | * It has one line-edit field for entering network interface's name and
|
---|
35 | * common dialog's ok/cancel buttons.
|
---|
36 | */
|
---|
37 | #if defined Q_WS_WIN
|
---|
38 | class VBoxAddNIDialog : public QDialog
|
---|
39 | {
|
---|
40 | Q_OBJECT
|
---|
41 |
|
---|
42 | public:
|
---|
43 |
|
---|
44 | VBoxAddNIDialog (QWidget *aParent, const QString &aIfaceName) :
|
---|
45 | QDialog (aParent, "VBoxAddNIDialog", true /* modal */),
|
---|
46 | mLeName (0)
|
---|
47 | {
|
---|
48 | setCaption (tr ("Add Host Interface"));
|
---|
49 | QVBoxLayout *mainLayout = new QVBoxLayout (this, 10, 10, "mainLayout");
|
---|
50 |
|
---|
51 | /* Setup Input layout */
|
---|
52 | QHBoxLayout *inputLayout = new QHBoxLayout (mainLayout, 10, "inputLayout");
|
---|
53 | QLabel *lbName = new QLabel (tr ("Interface Name"), this);
|
---|
54 | mLeName = new QLineEdit (aIfaceName, this);
|
---|
55 | QWhatsThis::add (mLeName, tr ("Descriptive name of the new network interface"));
|
---|
56 | inputLayout->addWidget (lbName);
|
---|
57 | inputLayout->addWidget (mLeName);
|
---|
58 | connect (mLeName, SIGNAL (textChanged (const QString &)),
|
---|
59 | this, SLOT (validate()));
|
---|
60 |
|
---|
61 | /* Setup Button layout */
|
---|
62 | QHBoxLayout *buttonLayout = new QHBoxLayout (mainLayout, 10, "buttonLayout");
|
---|
63 | mBtOk = new QPushButton (tr ("&OK"), this, "mBtOk");
|
---|
64 | QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
---|
65 | QPushButton *btCancel = new QPushButton (tr ("Cancel"), this, "btCancel");
|
---|
66 | connect (mBtOk, SIGNAL (clicked()), this, SLOT (accept()));
|
---|
67 | connect (btCancel, SIGNAL (clicked()), this, SLOT (reject()));
|
---|
68 | buttonLayout->addWidget (mBtOk);
|
---|
69 | buttonLayout->addItem (spacer);
|
---|
70 | buttonLayout->addWidget (btCancel);
|
---|
71 |
|
---|
72 | /* Validate interface name field */
|
---|
73 | validate();
|
---|
74 | }
|
---|
75 |
|
---|
76 | ~VBoxAddNIDialog() {}
|
---|
77 |
|
---|
78 | QString getName() { return mLeName->text(); }
|
---|
79 |
|
---|
80 | private slots:
|
---|
81 |
|
---|
82 | void validate()
|
---|
83 | {
|
---|
84 | mBtOk->setEnabled (!mLeName->text().isEmpty());
|
---|
85 | }
|
---|
86 |
|
---|
87 | private:
|
---|
88 |
|
---|
89 | void showEvent (QShowEvent *aEvent)
|
---|
90 | {
|
---|
91 | setFixedHeight (height());
|
---|
92 | QDialog::showEvent (aEvent);
|
---|
93 | }
|
---|
94 |
|
---|
95 | QPushButton *mBtOk;
|
---|
96 | QLineEdit *mLeName;
|
---|
97 | };
|
---|
98 | #endif
|
---|
99 |
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * VBoxVMNetworkSettings class to use as network interface setup page.
|
---|
103 | */
|
---|
104 | void VBoxVMNetworkSettings::init()
|
---|
105 | {
|
---|
106 | mNoInterfaces = tr ("<No suitable interfaces>");
|
---|
107 |
|
---|
108 | leMACAddress->setValidator (new QRegExpValidator (QRegExp ("[0-9,A-F]{12,12}"), this));
|
---|
109 |
|
---|
110 | cbNetworkAttachment->insertItem (vboxGlobal().toString (CEnums::NoNetworkAttachment));
|
---|
111 | cbNetworkAttachment->insertItem (vboxGlobal().toString (CEnums::NATNetworkAttachment));
|
---|
112 | #ifndef Q_WS_MAC /* not yet on the Mac */
|
---|
113 | cbNetworkAttachment->insertItem (vboxGlobal().toString (CEnums::HostInterfaceNetworkAttachment));
|
---|
114 | cbNetworkAttachment->insertItem (vboxGlobal().toString (CEnums::InternalNetworkAttachment));
|
---|
115 | #endif
|
---|
116 |
|
---|
117 | #if defined Q_WS_X11
|
---|
118 | leTAPDescriptor->setValidator (new QIntValidator (-1, std::numeric_limits <LONG>::max(), this));
|
---|
119 | #else
|
---|
120 | /* hide unavailable settings (TAP setup and terminate apps) */
|
---|
121 | frmTAPSetupTerminate->setHidden (true);
|
---|
122 | /* disable unused interface name UI */
|
---|
123 | frmHostInterface_X11->setHidden (true);
|
---|
124 | #endif
|
---|
125 |
|
---|
126 | #if defined Q_WS_WIN
|
---|
127 | /* setup iconsets */
|
---|
128 | pbHostAdd->setIconSet (VBoxGlobal::iconSet ("add_host_iface_16px.png",
|
---|
129 | "add_host_iface_disabled_16px.png"));
|
---|
130 | pbHostRemove->setIconSet (VBoxGlobal::iconSet ("remove_host_iface_16px.png",
|
---|
131 | "remove_host_iface_disabled_16px.png"));
|
---|
132 | /* setup languages */
|
---|
133 | QToolTip::add (pbHostAdd, tr ("Add"));
|
---|
134 | QToolTip::add (pbHostRemove, tr ("Remove"));
|
---|
135 | /* setup connections */
|
---|
136 | connect (grbEnabled, SIGNAL (toggled (bool)),
|
---|
137 | this, SLOT (grbEnabledToggled (bool)));
|
---|
138 | #else
|
---|
139 | /* disable unused interface name UI */
|
---|
140 | frmHostInterface_WIN->setHidden (true);
|
---|
141 | /* setup iconsets */
|
---|
142 | pbTAPSetup->setIconSet (VBoxGlobal::iconSet ("select_file_16px.png",
|
---|
143 | "select_file_dis_16px.png"));
|
---|
144 | pbTAPTerminate->setIconSet (VBoxGlobal::iconSet ("select_file_16px.png",
|
---|
145 | "select_file_dis_16px.png"));
|
---|
146 | #endif
|
---|
147 |
|
---|
148 | /* the TAP file descriptor setting is always invisible -- currently not used
|
---|
149 | * (remove the relative code at all? -- just leave for some time...) */
|
---|
150 | frmTAPDescriptor->setHidden (true);
|
---|
151 |
|
---|
152 | #if defined Q_WS_MAC
|
---|
153 | /* no Host Interface Networking on the Mac yet */
|
---|
154 | grbTAP->setHidden (true);
|
---|
155 | #endif
|
---|
156 | }
|
---|
157 |
|
---|
158 | bool VBoxVMNetworkSettings::isPageValid (const QStringList &aList)
|
---|
159 | {
|
---|
160 | #if defined Q_WS_WIN
|
---|
161 | CEnums::NetworkAttachmentType type =
|
---|
162 | vboxGlobal().toNetworkAttachmentType (cbNetworkAttachment->currentText());
|
---|
163 |
|
---|
164 | return !(type == CEnums::HostInterfaceNetworkAttachment &&
|
---|
165 | isInterfaceInvalid (aList, leHostInterfaceName->text()));
|
---|
166 | #else
|
---|
167 | NOREF (aList);
|
---|
168 | return true;
|
---|
169 | #endif
|
---|
170 | }
|
---|
171 |
|
---|
172 | void VBoxVMNetworkSettings::loadList (const QStringList &aList)
|
---|
173 | {
|
---|
174 | #if defined Q_WS_WIN
|
---|
175 | /* save current list item name */
|
---|
176 | QString currentListItemName = leHostInterfaceName->text();
|
---|
177 | /* load current list items */
|
---|
178 | lbHostInterface->clearFocus();
|
---|
179 | lbHostInterface->clear();
|
---|
180 | if (aList.count())
|
---|
181 | lbHostInterface->insertStringList (aList);
|
---|
182 | else
|
---|
183 | lbHostInterface->insertItem (mNoInterfaces);
|
---|
184 | selectListItem (currentListItemName);
|
---|
185 | /* disable interface delete button */
|
---|
186 | pbHostRemove->setEnabled (!aList.isEmpty());
|
---|
187 | #else
|
---|
188 | NOREF (aList);
|
---|
189 | #endif
|
---|
190 | }
|
---|
191 |
|
---|
192 | void VBoxVMNetworkSettings::getFromAdapter (const CNetworkAdapter &adapter)
|
---|
193 | {
|
---|
194 | cadapter = adapter;
|
---|
195 |
|
---|
196 | grbEnabled->setChecked (adapter.GetEnabled());
|
---|
197 |
|
---|
198 | CEnums::NetworkAttachmentType type = adapter.GetAttachmentType();
|
---|
199 | cbNetworkAttachment->setCurrentItem (0);
|
---|
200 | for (int i = 0; i < cbNetworkAttachment->count(); i ++)
|
---|
201 | if (vboxGlobal().toNetworkAttachmentType (cbNetworkAttachment->text (i)) == type)
|
---|
202 | {
|
---|
203 | cbNetworkAttachment->setCurrentItem (i);
|
---|
204 | cbNetworkAttachment_activated (cbNetworkAttachment->currentText());
|
---|
205 | break;
|
---|
206 | }
|
---|
207 |
|
---|
208 | leMACAddress->setText (adapter.GetMACAddress());
|
---|
209 |
|
---|
210 | chbCableConnected->setChecked (adapter.GetCableConnected());
|
---|
211 |
|
---|
212 | #if defined Q_WS_WIN
|
---|
213 | selectListItem (adapter.GetHostInterface());
|
---|
214 | #else
|
---|
215 | leHostInterface->setText (adapter.GetHostInterface());
|
---|
216 | #endif
|
---|
217 |
|
---|
218 | #if defined Q_WS_X11
|
---|
219 | leTAPDescriptor->setText (QString::number (adapter.GetTAPFileDescriptor()));
|
---|
220 | leTAPSetup->setText (adapter.GetTAPSetupApplication());
|
---|
221 | leTAPTerminate->setText (adapter.GetTAPTerminateApplication());
|
---|
222 | #endif
|
---|
223 | }
|
---|
224 |
|
---|
225 | void VBoxVMNetworkSettings::putBackToAdapter()
|
---|
226 | {
|
---|
227 | cadapter.SetEnabled (grbEnabled->isChecked());
|
---|
228 |
|
---|
229 | CEnums::NetworkAttachmentType type =
|
---|
230 | vboxGlobal().toNetworkAttachmentType (cbNetworkAttachment->currentText());
|
---|
231 | switch (type)
|
---|
232 | {
|
---|
233 | case CEnums::NoNetworkAttachment:
|
---|
234 | cadapter.Detach();
|
---|
235 | break;
|
---|
236 | case CEnums::NATNetworkAttachment:
|
---|
237 | cadapter.AttachToNAT();
|
---|
238 | break;
|
---|
239 | case CEnums::HostInterfaceNetworkAttachment:
|
---|
240 | cadapter.AttachToHostInterface();
|
---|
241 | break;
|
---|
242 | case CEnums::InternalNetworkAttachment:
|
---|
243 | cadapter.AttachToInternalNetwork();
|
---|
244 | break;
|
---|
245 | default:
|
---|
246 | AssertMsgFailed (("Invalid network attachment type: %d", type));
|
---|
247 | break;
|
---|
248 | }
|
---|
249 |
|
---|
250 | cadapter.SetMACAddress (leMACAddress->text());
|
---|
251 |
|
---|
252 | cadapter.SetCableConnected (chbCableConnected->isChecked());
|
---|
253 |
|
---|
254 | if (type == CEnums::HostInterfaceNetworkAttachment)
|
---|
255 | {
|
---|
256 | #if defined Q_WS_WIN
|
---|
257 | if (!lbHostInterface->currentText().isEmpty())
|
---|
258 | cadapter.SetHostInterface (lbHostInterface->currentText());
|
---|
259 | #else
|
---|
260 | QString iface = leHostInterface->text();
|
---|
261 | cadapter.SetHostInterface (iface.isEmpty() ? QString::null : iface);
|
---|
262 | #endif
|
---|
263 | #if defined Q_WS_X11
|
---|
264 | cadapter.SetTAPFileDescriptor (leTAPDescriptor->text().toLong());
|
---|
265 | QString setup = leTAPSetup->text();
|
---|
266 | cadapter.SetTAPSetupApplication (setup.isEmpty() ? QString::null : setup);
|
---|
267 | QString term = leTAPTerminate->text();
|
---|
268 | cadapter.SetTAPTerminateApplication (term.isEmpty() ? QString::null : term);
|
---|
269 | #endif
|
---|
270 | }
|
---|
271 | }
|
---|
272 |
|
---|
273 | void VBoxVMNetworkSettings::setValidator (QIWidgetValidator *aWalidator)
|
---|
274 | {
|
---|
275 | mWalidator = aWalidator;
|
---|
276 | }
|
---|
277 |
|
---|
278 | void VBoxVMNetworkSettings::revalidate()
|
---|
279 | {
|
---|
280 | mWalidator->revalidate();
|
---|
281 | }
|
---|
282 |
|
---|
283 | void VBoxVMNetworkSettings::grbEnabledToggled (bool aOn)
|
---|
284 | {
|
---|
285 | #if defined Q_WS_WIN
|
---|
286 | if (!aOn)
|
---|
287 | {
|
---|
288 | lbHostInterface->clearFocus();
|
---|
289 | cbNetworkAttachment->setCurrentItem (0);
|
---|
290 | cbNetworkAttachment_activated (cbNetworkAttachment->currentText());
|
---|
291 | if (lbHostInterface->selectedItem())
|
---|
292 | lbHostInterface->setSelected (lbHostInterface->selectedItem(), false);
|
---|
293 | }
|
---|
294 | if (lbHostInterface->currentItem() != -1)
|
---|
295 | lbHostInterface->setSelected (lbHostInterface->currentItem(), aOn);
|
---|
296 | #else
|
---|
297 | NOREF (aOn);
|
---|
298 | #endif
|
---|
299 | }
|
---|
300 |
|
---|
301 | void VBoxVMNetworkSettings::selectListItem (const QString &aItemName)
|
---|
302 | {
|
---|
303 | if (!aItemName.isEmpty())
|
---|
304 | {
|
---|
305 | #if defined Q_WS_WIN
|
---|
306 | leHostInterfaceName->setText (aItemName);
|
---|
307 | QListBoxItem* adapterNode = lbHostInterface->findItem (aItemName);
|
---|
308 | if (adapterNode)
|
---|
309 | {
|
---|
310 | lbHostInterface->setCurrentItem (adapterNode);
|
---|
311 | lbHostInterface->setSelected (adapterNode, true);
|
---|
312 | }
|
---|
313 | #endif
|
---|
314 | }
|
---|
315 | }
|
---|
316 |
|
---|
317 | void VBoxVMNetworkSettings::cbNetworkAttachment_activated (const QString &aString)
|
---|
318 | {
|
---|
319 | #if defined Q_WS_WIN
|
---|
320 | bool enableHostIf = vboxGlobal().toNetworkAttachmentType (aString) ==
|
---|
321 | CEnums::HostInterfaceNetworkAttachment;
|
---|
322 | txHostInterface_WIN->setEnabled (enableHostIf);
|
---|
323 | leHostInterfaceName->setEnabled (enableHostIf);
|
---|
324 | lbHostInterface_highlighted (lbHostInterface->selectedItem());
|
---|
325 | #else
|
---|
326 | NOREF (aString);
|
---|
327 | #endif
|
---|
328 | }
|
---|
329 |
|
---|
330 | void VBoxVMNetworkSettings::lbHostInterface_highlighted (QListBoxItem *aItem)
|
---|
331 | {
|
---|
332 | if (!aItem) return;
|
---|
333 | #if defined Q_WS_WIN
|
---|
334 | leHostInterfaceName->setText (leHostInterfaceName->isEnabled() ?
|
---|
335 | aItem->text() : QString::null);
|
---|
336 | if (!lbHostInterface->isSelected (aItem))
|
---|
337 | lbHostInterface->setSelected (aItem, true);
|
---|
338 | #endif
|
---|
339 | }
|
---|
340 |
|
---|
341 | bool VBoxVMNetworkSettings::isInterfaceInvalid (const QStringList &aList,
|
---|
342 | const QString &aIface)
|
---|
343 | {
|
---|
344 | #if defined Q_WS_WIN
|
---|
345 | return aList.find (aIface) == aList.end();
|
---|
346 | #else
|
---|
347 | NOREF (aList);
|
---|
348 | NOREF (aIface);
|
---|
349 | return false;
|
---|
350 | #endif
|
---|
351 | }
|
---|
352 |
|
---|
353 | void VBoxVMNetworkSettings::pbGenerateMAC_clicked()
|
---|
354 | {
|
---|
355 | cadapter.SetMACAddress (QString::null);
|
---|
356 | leMACAddress->setText (cadapter.GetMACAddress());
|
---|
357 | }
|
---|
358 |
|
---|
359 | void VBoxVMNetworkSettings::pbTAPSetup_clicked()
|
---|
360 | {
|
---|
361 | QString selected = QFileDialog::getOpenFileName (
|
---|
362 | "/",
|
---|
363 | QString::null,
|
---|
364 | this,
|
---|
365 | NULL,
|
---|
366 | tr ("Select TAP setup application"));
|
---|
367 |
|
---|
368 | if (selected)
|
---|
369 | leTAPSetup->setText (selected);
|
---|
370 | }
|
---|
371 |
|
---|
372 | void VBoxVMNetworkSettings::pbTAPTerminate_clicked()
|
---|
373 | {
|
---|
374 | QString selected = QFileDialog::getOpenFileName (
|
---|
375 | "/",
|
---|
376 | QString::null,
|
---|
377 | this,
|
---|
378 | NULL,
|
---|
379 | tr ("Select TAP terminate application"));
|
---|
380 |
|
---|
381 | if (selected)
|
---|
382 | leTAPTerminate->setText (selected);
|
---|
383 | }
|
---|
384 |
|
---|
385 | void VBoxVMNetworkSettings::hostInterfaceAdd()
|
---|
386 | {
|
---|
387 | #if defined Q_WS_WIN
|
---|
388 |
|
---|
389 | /* allow the started helper process to make itself the foreground window */
|
---|
390 | AllowSetForegroundWindow (ASFW_ANY);
|
---|
391 |
|
---|
392 | /* search for the max available interface index */
|
---|
393 | int ifaceNumber = 0;
|
---|
394 | QString ifaceName = tr ("VirtualBox Host Interface %1");
|
---|
395 | QRegExp regExp (QString ("^") + ifaceName.arg ("([0-9]+)") + QString ("$"));
|
---|
396 | for (uint index = 0; index < lbHostInterface->count(); ++ index)
|
---|
397 | {
|
---|
398 | QString iface = lbHostInterface->text (index);
|
---|
399 | int pos = regExp.search (iface);
|
---|
400 | if (pos != -1)
|
---|
401 | ifaceNumber = regExp.cap (1).toInt() > ifaceNumber ?
|
---|
402 | regExp.cap (1).toInt() : ifaceNumber;
|
---|
403 | }
|
---|
404 |
|
---|
405 | /* creating add host interface dialog */
|
---|
406 | VBoxAddNIDialog dlg (this, ifaceName.arg (ifaceNumber + 1));
|
---|
407 | if (dlg.exec() != QDialog::Accepted)
|
---|
408 | return;
|
---|
409 | QString iName = dlg.getName();
|
---|
410 |
|
---|
411 | /* create interface */
|
---|
412 | CHost host = vboxGlobal().virtualBox().GetHost();
|
---|
413 | CHostNetworkInterface iFace;
|
---|
414 | CProgress progress = host.CreateHostNetworkInterface (iName, iFace);
|
---|
415 | if (host.isOk())
|
---|
416 | {
|
---|
417 | vboxProblem().showModalProgressDialog (progress, iName, this);
|
---|
418 | if (progress.GetResultCode() == 0)
|
---|
419 | {
|
---|
420 | /* add&select newly created created interface */
|
---|
421 | delete lbHostInterface->findItem (mNoInterfaces);
|
---|
422 | lbHostInterface->insertItem (iName);
|
---|
423 | selectListItem (iName);
|
---|
424 | pbHostRemove->setEnabled (true);
|
---|
425 | emit listChanged (this);
|
---|
426 | }
|
---|
427 | else
|
---|
428 | vboxProblem().cannotCreateHostInterface (progress, iName, this);
|
---|
429 | }
|
---|
430 | else
|
---|
431 | vboxProblem().cannotCreateHostInterface (host, iName, this);
|
---|
432 |
|
---|
433 | /* allow the started helper process to make itself the foreground window */
|
---|
434 | AllowSetForegroundWindow (ASFW_ANY);
|
---|
435 |
|
---|
436 | #endif
|
---|
437 | }
|
---|
438 |
|
---|
439 | void VBoxVMNetworkSettings::hostInterfaceRemove()
|
---|
440 | {
|
---|
441 | #if defined Q_WS_WIN
|
---|
442 |
|
---|
443 | /* allow the started helper process to make itself the foreground window */
|
---|
444 | AllowSetForegroundWindow (ASFW_ANY);
|
---|
445 |
|
---|
446 | /* check interface name */
|
---|
447 | QString iName = lbHostInterface->currentText();
|
---|
448 | if (iName.isEmpty())
|
---|
449 | return;
|
---|
450 |
|
---|
451 | /* asking user about deleting selected network interface */
|
---|
452 | int delNetIface = vboxProblem().message (this, VBoxProblemReporter::Question,
|
---|
453 | tr ("<p>Do you want to remove the selected host network interface "
|
---|
454 | "<nobr><b>%1</b>?</nobr></p>"
|
---|
455 | "<p><b>Note:</b> This interface may be in use by one or more "
|
---|
456 | "network adapters of this or another VM. After it is removed, these "
|
---|
457 | "adapters will no longer work until you correct their settings by "
|
---|
458 | "either choosing a differnet interface name or a different adapter "
|
---|
459 | "attachment type.</p>").arg (iName),
|
---|
460 | 0, /* autoConfirmId */
|
---|
461 | QIMessageBox::Ok | QIMessageBox::Default,
|
---|
462 | QIMessageBox::Cancel | QIMessageBox::Escape);
|
---|
463 | if (delNetIface == QIMessageBox::Cancel)
|
---|
464 | return;
|
---|
465 |
|
---|
466 | CHost host = vboxGlobal().virtualBox().GetHost();
|
---|
467 | CHostNetworkInterface iFace = host.GetNetworkInterfaces().FindByName (iName);
|
---|
468 | if (host.isOk())
|
---|
469 | {
|
---|
470 | /* delete interface */
|
---|
471 | CProgress progress = host.RemoveHostNetworkInterface (iFace.GetId(), iFace);
|
---|
472 | if (host.isOk())
|
---|
473 | {
|
---|
474 | vboxProblem().showModalProgressDialog (progress, iName, this);
|
---|
475 | if (progress.GetResultCode() == 0)
|
---|
476 | {
|
---|
477 | if (lbHostInterface->count() == 1)
|
---|
478 | {
|
---|
479 | lbHostInterface->insertItem (mNoInterfaces);
|
---|
480 | pbHostRemove->setEnabled (false);
|
---|
481 | }
|
---|
482 | delete lbHostInterface->findItem (iName);
|
---|
483 | emit listChanged (this);
|
---|
484 | }
|
---|
485 | else
|
---|
486 | vboxProblem().cannotRemoveHostInterface (progress, iFace, this);
|
---|
487 | }
|
---|
488 | }
|
---|
489 |
|
---|
490 | if (!host.isOk())
|
---|
491 | vboxProblem().cannotRemoveHostInterface (host, iFace, this);
|
---|
492 | #endif
|
---|
493 | }
|
---|
494 |
|
---|
495 | #if defined Q_WS_WIN
|
---|
496 | #include "VBoxVMNetworkSettings.ui.moc"
|
---|
497 | #endif
|
---|