Index: trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 71936)
+++ trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 71937)
@@ -558,5 +558,4 @@
 	src/widgets/UIEmptyFilePathSelector.h \
 	src/widgets/UILineTextEdit.h \
-	src/widgets/UIPortForwardingTable.h \
 	src/widgets/UISlidingWidget.h \
 	src/widgets/UITabBar.h \
@@ -693,4 +692,5 @@
 	src/widgets/UIPopupStack.h \
 	src/widgets/UIPopupStackViewport.h \
+	src/widgets/UIPortForwardingTable.h \
 	src/widgets/UIProgressDialog.h \
 	src/widgets/UISpecialControls.h \
@@ -788,4 +788,5 @@
 	src/widgets/UIPopupStack.h \
 	src/widgets/UIPopupStackViewport.h \
+	src/widgets/UIPortForwardingTable.h \
 	src/widgets/UIProgressDialog.h \
 	src/widgets/UISpecialControls.h \
@@ -840,5 +841,4 @@
 	src/widgets/UIMenuToolBar.cpp \
 	src/widgets/UIMiniToolBar.cpp \
-	src/widgets/UIPortForwardingTable.cpp \
 	src/widgets/UITabBar.cpp \
 	src/wizards/importappliance/UIWizardImportApp.cpp
@@ -862,4 +862,5 @@
 	src/widgets/UIFilmContainer.cpp \
 	src/widgets/UIHotKeyEditor.cpp \
+	src/widgets/UIPortForwardingTable.cpp \
 	src/widgets/UIProgressDialog.cpp
 
@@ -902,4 +903,5 @@
 	src/widgets/UIFilmContainer.cpp \
 	src/widgets/UIHotKeyEditor.cpp \
+	src/widgets/UIPortForwardingTable.cpp \
 	src/widgets/UIProgressDialog.cpp
 
@@ -1051,5 +1053,4 @@
 	src/widgets/UIEmptyFilePathSelector.cpp \
 	src/widgets/UILineTextEdit.cpp \
-	src/widgets/UIPortForwardingTable.cpp \
 	src/widgets/UISlidingWidget.cpp \
 	src/widgets/UITabBar.cpp \
@@ -1226,4 +1227,5 @@
 	src/widgets/UIPopupStack.cpp \
 	src/widgets/UIPopupStackViewport.cpp \
+	src/widgets/UIPortForwardingTable.cpp \
 	src/widgets/UIProgressDialog.cpp \
 	src/widgets/UISpecialControls.cpp \
@@ -1347,4 +1349,5 @@
 	src/widgets/UIPopupStack.cpp \
 	src/widgets/UIPopupStackViewport.cpp \
+	src/widgets/UIPortForwardingTable.cpp \
 	src/widgets/UIProgressDialog.cpp \
 	src/widgets/UISpecialControls.cpp \
Index: trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp	(revision 71936)
+++ trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp	(revision 71937)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2010-2017 Oracle Corporation
+ * Copyright (C) 2010-2018 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -21,22 +21,22 @@
 
 /* Qt includes: */
+# include <QAction>
+# include <QComboBox>
 # include <QHBoxLayout>
+# include <QHeaderView>
+# include <QItemEditorFactory>
+# include <QLineEdit>
 # include <QMenu>
-# include <QAction>
-# include <QHeaderView>
+# include <QSpinBox>
 # include <QStyledItemDelegate>
-# include <QItemEditorFactory>
-# include <QComboBox>
-# include <QLineEdit>
-# include <QSpinBox>
 
 /* GUI includes: */
+# include "QITableView.h"
 # include "UIDesktopWidgetWatchdog.h"
-# include "UIPortForwardingTable.h"
-# include "UIMessageCenter.h"
 # include "UIConverter.h"
 # include "UIIconPool.h"
+# include "UIMessageCenter.h"
+# include "UIPortForwardingTable.h"
 # include "UIToolBar.h"
-# include "QITableView.h"
 
 /* Other VBox includes: */
@@ -47,61 +47,4 @@
 /* External includes: */
 #include <math.h>
-
-
-#if 0 /* Decided to not use it for now. */
-/* IPv4 validator: */
-class IPv4Validator : public QValidator
-{
-    Q_OBJECT;
-
-public:
-
-    /* Constructor/destructor: */
-    IPv4Validator(QObject *pParent) : QValidator(pParent) {}
-    ~IPv4Validator() {}
-
-    /* Handler: Validation stuff: */
-    QValidator::State validate(QString &strInput, int& /*iPos*/) const
-    {
-        QString strStringToValidate(strInput);
-        strStringToValidate.remove(' ');
-        QString strDot("\\.");
-        QString strDigits("(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]?|0)");
-        QRegExp intRegExp(QString("^(%1?(%2(%1?(%2(%1?(%2%1?)?)?)?)?)?)?$").arg(strDigits).arg(strDot));
-        RTNETADDRIPV4 Network, Mask;
-        if (strStringToValidate == "..." || RTCidrStrToIPv4(strStringToValidate.toLatin1().constData(), &Network, &Mask) == VINF_SUCCESS)
-            return QValidator::Acceptable;
-        else if (intRegExp.indexIn(strStringToValidate) != -1)
-            return QValidator::Intermediate;
-        else
-            return QValidator::Invalid;
-    }
-};
-
-/* IPv6 validator: */
-class IPv6Validator : public QValidator
-{
-    Q_OBJECT;
-
-public:
-
-    /* Constructor/destructor: */
-    IPv6Validator(QObject *pParent) : QValidator(pParent) {}
-    ~IPv6Validator() {}
-
-    /* Handler: Validation stuff: */
-    QValidator::State validate(QString &strInput, int& /*iPos*/) const
-    {
-        QString strStringToValidate(strInput);
-        strStringToValidate.remove(' ');
-        QString strDigits("([0-9a-fA-F]{0,4})");
-        QRegExp intRegExp(QString("^%1(:%1(:%1(:%1(:%1(:%1(:%1(:%1)?)?)?)?)?)?)?$").arg(strDigits));
-        if (intRegExp.indexIn(strStringToValidate) != -1)
-            return QValidator::Acceptable;
-        else
-            return QValidator::Invalid;
-    }
-};
-#endif /* Decided to not use it for now. */
 
 
@@ -119,5 +62,5 @@
 
 
-/* Name editor: */
+/** QLineEdit extension used as name editor. */
 class NameEditor : public QLineEdit
 {
@@ -127,5 +70,5 @@
 public:
 
-    /* Constructor: */
+    /** Constructs name editor passing @a pParent to the base-class. */
     NameEditor(QWidget *pParent = 0) : QLineEdit(pParent)
     {
@@ -137,11 +80,11 @@
 private:
 
-    /* API: Name stuff: */
-    void setName(NameData name)
-    {
-        setText(name);
-    }
-
-    /* API: Name stuff: */
+    /** Defines the @a strName. */
+    void setName(NameData strName)
+    {
+        setText(strName);
+    }
+
+    /** Returns the name. */
     NameData name() const
     {
@@ -151,5 +94,5 @@
 
 
-/* Protocol editor: */
+/** QComboBox extension used as protocol editor. */
 class ProtocolEditor : public QComboBox
 {
@@ -159,5 +102,5 @@
 public:
 
-    /* Constructor: */
+    /** Constructs protocol editor passing @a pParent to the base-class. */
     ProtocolEditor(QWidget *pParent = 0) : QComboBox(pParent)
     {
@@ -168,10 +111,10 @@
 private:
 
-    /* API: Protocol stuff: */
-    void setProtocol(KNATProtocol p)
+    /** Defines the @a enmProtocol. */
+    void setProtocol(KNATProtocol enmProtocol)
     {
         for (int i = 0; i < count(); ++i)
         {
-            if (itemData(i).value<KNATProtocol>() == p)
+            if (itemData(i).value<KNATProtocol>() == enmProtocol)
             {
                 setCurrentIndex(i);
@@ -181,5 +124,5 @@
     }
 
-    /* API: Protocol stuff: */
+    /** Returns the protocol. */
     KNATProtocol protocol() const
     {
@@ -189,5 +132,5 @@
 
 
-/* IPv4 editor: */
+/** QLineEdit extension used as IPv4 editor. */
 class IPv4Editor : public QLineEdit
 {
@@ -197,5 +140,5 @@
 public:
 
-    /* Constructor: */
+    /** Constructs IPv4-editor passing @a pParent to the base-class. */
     IPv4Editor(QWidget *pParent = 0) : QLineEdit(pParent)
     {
@@ -208,11 +151,11 @@
 private:
 
-    /* API: IP stuff: */
-    void setIp(IpData ip)
-    {
-        setText(ip);
-    }
-
-    /* API: IP stuff: */
+    /** Defines the @a strIp. */
+    void setIp(IpData strIp)
+    {
+        setText(strIp);
+    }
+
+    /** Returns the ip. */
     IpData ip() const
     {
@@ -222,5 +165,5 @@
 
 
-/* IPv6 editor: */
+/** QLineEdit extension used as IPv6 editor. */
 class IPv6Editor : public QLineEdit
 {
@@ -230,5 +173,5 @@
 public:
 
-    /* Constructor: */
+    /** Constructs IPv6-editor passing @a pParent to the base-class. */
     IPv6Editor(QWidget *pParent = 0) : QLineEdit(pParent)
     {
@@ -241,11 +184,11 @@
 private:
 
-    /* API: IP stuff: */
-    void setIp(IpData ip)
-    {
-        setText(ip);
-    }
-
-    /* API: IP stuff: */
+    /** Defines the @a strIp. */
+    void setIp(IpData strIp)
+    {
+        setText(strIp);
+    }
+
+    /** Returns the ip. */
     IpData ip() const
     {
@@ -255,5 +198,5 @@
 
 
-/* Port editor: */
+/** QSpinBox extension used as Port editor. */
 class PortEditor : public QSpinBox
 {
@@ -263,5 +206,5 @@
 public:
 
-    /* Constructor: */
+    /** Constructs Port-editor passing @a pParent to the base-class. */
     PortEditor(QWidget *pParent = 0) : QSpinBox(pParent)
     {
@@ -272,5 +215,5 @@
 private:
 
-    /* API: Port stuff: */
+    /** Defines the @a port. */
     void setPort(PortData port)
     {
@@ -278,5 +221,5 @@
     }
 
-    /* API: Port stuff: */
+    /** Returns the port. */
     PortData port() const
     {
@@ -309,14 +252,14 @@
     /** Constructs table cell passing @a pParent to the base-class.
       * @param  strIp  Brings the IP address. */
-    UIPortForwardingCell(QITableViewRow *pParent, const IpData &strIP)
+    UIPortForwardingCell(QITableViewRow *pParent, const IpData &strIp)
         : QITableViewCell(pParent)
-        , m_strText(strIP)
+        , m_strText(strIp)
     {}
 
     /** Constructs table cell passing @a pParent to the base-class.
-      * @param  uHostPort  Brings the port. */
-    UIPortForwardingCell(QITableViewRow *pParent, PortData uPort)
+      * @param  port  Brings the port. */
+    UIPortForwardingCell(QITableViewRow *pParent, PortData port)
         : QITableViewCell(pParent)
-        , m_strText(QString::number(uPort.value()))
+        , m_strText(QString::number(port.value()))
     {}
 
@@ -327,5 +270,5 @@
 
     /** Holds the cell text. */
-    QString m_strText;
+    QString  m_strText;
 };
 
@@ -342,15 +285,15 @@
       * @param  enmProtocol  Brings the rule protocol type.
       * @param  strHostIp    Brings the rule host IP address.
-      * @param  uHostPort    Brings the rule host port.
+      * @param  hostPort     Brings the rule host port.
       * @param  strGuestIp   Brings the rule guest IP address.
-      * @param  uGuestPort   Brings the rule guest port. */
+      * @param  guestPort    Brings the rule guest port. */
     UIPortForwardingRow(QITableView *pParent,
                         const NameData &strName, KNATProtocol enmProtocol,
-                        const IpData &strHostIp, PortData uHostPort,
-                        const IpData &strGuestIp, PortData uGuestPort)
+                        const IpData &strHostIp, PortData hostPort,
+                        const IpData &strGuestIp, PortData guestPort)
         : QITableViewRow(pParent)
         , m_strName(strName), m_enmProtocol(enmProtocol)
-        , m_strHostIp(strHostIp), m_uHostPort(uHostPort)
-        , m_strGuestIp(strGuestIp), m_uGuestPort(uGuestPort)
+        , m_strHostIp(strHostIp), m_hostPort(hostPort)
+        , m_strGuestIp(strGuestIp), m_guestPort(guestPort)
     {
         /* Create cells: */
@@ -396,11 +339,11 @@
 
     /** Returns the rule host port. */
-    PortData hostPort() const { return m_uHostPort; }
+    PortData hostPort() const { return m_hostPort; }
     /** Defines the rule host port. */
-    void setHostPort(PortData uHostPort)
-    {
-        m_uHostPort = uHostPort;
+    void setHostPort(PortData hostPort)
+    {
+        m_hostPort = hostPort;
         delete m_cells[UIPortForwardingDataType_HostPort];
-        m_cells[UIPortForwardingDataType_HostPort] = new UIPortForwardingCell(this, m_uHostPort);
+        m_cells[UIPortForwardingDataType_HostPort] = new UIPortForwardingCell(this, m_hostPort);
     }
 
@@ -416,11 +359,11 @@
 
     /** Returns the rule guest port. */
-    PortData guestPort() const { return m_uGuestPort; }
+    PortData guestPort() const { return m_guestPort; }
     /** Defines the rule guest port. */
-    void setGuestPort(PortData uGuestPort)
-    {
-        m_uGuestPort = uGuestPort;
+    void setGuestPort(PortData guestPort)
+    {
+        m_guestPort = guestPort;
         delete m_cells[UIPortForwardingDataType_GuestPort];
-        m_cells[UIPortForwardingDataType_GuestPort] = new UIPortForwardingCell(this, m_uGuestPort);
+        m_cells[UIPortForwardingDataType_GuestPort] = new UIPortForwardingCell(this, m_guestPort);
     }
 
@@ -453,7 +396,7 @@
         m_cells[UIPortForwardingDataType_Protocol] = new UIPortForwardingCell(this, m_enmProtocol);
         m_cells[UIPortForwardingDataType_HostIp] = new UIPortForwardingCell(this, m_strHostIp);
-        m_cells[UIPortForwardingDataType_HostPort] = new UIPortForwardingCell(this, m_uHostPort);
+        m_cells[UIPortForwardingDataType_HostPort] = new UIPortForwardingCell(this, m_hostPort);
         m_cells[UIPortForwardingDataType_GuestIp] = new UIPortForwardingCell(this, m_strGuestIp);
-        m_cells[UIPortForwardingDataType_GuestPort] = new UIPortForwardingCell(this, m_uGuestPort);
+        m_cells[UIPortForwardingDataType_GuestPort] = new UIPortForwardingCell(this, m_guestPort);
     }
 
@@ -473,9 +416,9 @@
     IpData m_strHostIp;
     /** Holds the rule host port. */
-    PortData m_uHostPort;
+    PortData m_hostPort;
     /** Holds the rule guest IP address. */
     IpData m_strGuestIp;
     /** Holds the rule guest port. */
-    PortData m_uGuestPort;
+    PortData m_guestPort;
 
     /** Holds the cell instances. */
@@ -484,5 +427,5 @@
 
 
-/* Port forwarding data model: */
+/** QAbstractTableModel subclass used as port forwarding data model. */
 class UIPortForwardingModel : public QAbstractTableModel
 {
@@ -502,24 +445,30 @@
     QITableViewRow *childItem(int iIndex) const;
 
-    /* API: Rule stuff: */
+    /** Returns the list of port forwarding rules. */
     const UIPortForwardingDataList rules() const;
+    /** Adds empty port forwarding rule for certain @a index. */
     void addRule(const QModelIndex &index);
-    void delRule(const QModelIndex &index);
-
-    /* API: Index flag stuff: */
+    /** Removes port forwarding rule with certain @a index. */
+    void removeRule(const QModelIndex &index);
+
+    /** Returns flags for item with certain @a index. */
     Qt::ItemFlags flags(const QModelIndex &index) const;
 
-    /* API: Index row-count stuff: */
+    /** Returns row count of certain @a parent. */
     int rowCount(const QModelIndex &parent = QModelIndex()) const;
 
-    /* API: Index column-count stuff: */
+    /** Returns column count of certain @a parent. */
     int columnCount(const QModelIndex &parent = QModelIndex()) const;
 
-    /* API: Header data stuff: */
-    QVariant headerData(int iSection, Qt::Orientation orientation, int iRole) const;
-
-    /* API: Index data stuff: */
+    /** Returns header data.
+      * @param  iSection        Brings the number of section we aquire data for.
+      * @param  enmOrientation  Brings the orientation of header we aquire data for.
+      * @param  iRole           Brings the role we aquire data for. */
+    QVariant headerData(int iSection, Qt::Orientation enmOrientation, int iRole) const;
+
+    /** Defines the @a iRole data for item with @a index as @a value. */
+    bool setData(const QModelIndex &index, const QVariant &value, int iRole = Qt::EditRole);
+    /** Returns the @a iRole data for item with @a index. */
     QVariant data(const QModelIndex &index, int iRole) const;
-    bool setData(const QModelIndex &index, const QVariant &value, int iRole = Qt::EditRole);
 
 private:
@@ -528,5 +477,5 @@
     QITableView *parentTable() const;
 
-    /* Variable: Data stuff: */
+    /** Holds the port forwarding row list.  */
     QList<UIPortForwardingRow*> m_dataList;
 };
@@ -556,5 +505,6 @@
 *********************************************************************************************************************************/
 
-UIPortForwardingModel::UIPortForwardingModel(QITableView *pParent, const UIPortForwardingDataList &rules /* = UIPortForwardingDataList() */)
+UIPortForwardingModel::UIPortForwardingModel(QITableView *pParent,
+                                             const UIPortForwardingDataList &rules /* = UIPortForwardingDataList() */)
     : QAbstractTableModel(pParent)
 {
@@ -623,5 +573,5 @@
 }
 
-void UIPortForwardingModel::delRule(const QModelIndex &index)
+void UIPortForwardingModel::removeRule(const QModelIndex &index)
 {
     if (!index.isValid())
@@ -642,18 +592,18 @@
 }
 
-int UIPortForwardingModel::rowCount(const QModelIndex&) const
+int UIPortForwardingModel::rowCount(const QModelIndex &) const
 {
     return m_dataList.size();
 }
 
-int UIPortForwardingModel::columnCount(const QModelIndex&) const
+int UIPortForwardingModel::columnCount(const QModelIndex &) const
 {
     return UIPortForwardingDataType_Max;
 }
 
-QVariant UIPortForwardingModel::headerData(int iSection, Qt::Orientation orientation, int iRole) const
+QVariant UIPortForwardingModel::headerData(int iSection, Qt::Orientation enmOrientation, int iRole) const
 {
     /* Display role for horizontal header: */
-    if (iRole == Qt::DisplayRole && orientation == Qt::Horizontal)
+    if (iRole == Qt::DisplayRole && enmOrientation == Qt::Horizontal)
     {
         /* Switch for different columns: */
@@ -671,4 +621,41 @@
     /* Return wrong value: */
     return QVariant();
+}
+
+bool UIPortForwardingModel::setData(const QModelIndex &index, const QVariant &value, int iRole /* = Qt::EditRole */)
+{
+    /* Check index validness: */
+    if (!index.isValid() || iRole != Qt::EditRole)
+        return false;
+    /* Switch for different columns: */
+    switch (index.column())
+    {
+        case UIPortForwardingDataType_Name:
+            m_dataList[index.row()]->setName(value.value<NameData>());
+            emit dataChanged(index, index);
+            return true;
+        case UIPortForwardingDataType_Protocol:
+            m_dataList[index.row()]->setProtocol(value.value<KNATProtocol>());
+            emit dataChanged(index, index);
+            return true;
+        case UIPortForwardingDataType_HostIp:
+            m_dataList[index.row()]->setHostIp(value.value<IpData>());
+            emit dataChanged(index, index);
+            return true;
+        case UIPortForwardingDataType_HostPort:
+            m_dataList[index.row()]->setHostPort(value.value<PortData>());
+            emit dataChanged(index, index);
+            return true;
+        case UIPortForwardingDataType_GuestIp:
+            m_dataList[index.row()]->setGuestIp(value.value<IpData>());
+            emit dataChanged(index, index);
+            return true;
+        case UIPortForwardingDataType_GuestPort:
+            m_dataList[index.row()]->setGuestPort(value.value<PortData>());
+            emit dataChanged(index, index);
+            return true;
+        default: return false;
+    }
+    /* not reached! */
 }
 
@@ -745,41 +732,4 @@
 }
 
-bool UIPortForwardingModel::setData(const QModelIndex &index, const QVariant &value, int iRole /* = Qt::EditRole */)
-{
-    /* Check index validness: */
-    if (!index.isValid() || iRole != Qt::EditRole)
-        return false;
-    /* Switch for different columns: */
-    switch (index.column())
-    {
-        case UIPortForwardingDataType_Name:
-            m_dataList[index.row()]->setName(value.value<NameData>());
-            emit dataChanged(index, index);
-            return true;
-        case UIPortForwardingDataType_Protocol:
-            m_dataList[index.row()]->setProtocol(value.value<KNATProtocol>());
-            emit dataChanged(index, index);
-            return true;
-        case UIPortForwardingDataType_HostIp:
-            m_dataList[index.row()]->setHostIp(value.value<IpData>());
-            emit dataChanged(index, index);
-            return true;
-        case UIPortForwardingDataType_HostPort:
-            m_dataList[index.row()]->setHostPort(value.value<PortData>());
-            emit dataChanged(index, index);
-            return true;
-        case UIPortForwardingDataType_GuestIp:
-            m_dataList[index.row()]->setGuestIp(value.value<IpData>());
-            emit dataChanged(index, index);
-            return true;
-        case UIPortForwardingDataType_GuestPort:
-            m_dataList[index.row()]->setGuestPort(value.value<PortData>());
-            emit dataChanged(index, index);
-            return true;
-        default: return false;
-    }
-    /* not reached! */
-}
-
 QITableView *UIPortForwardingModel::parentTable() const
 {
@@ -810,142 +760,23 @@
 
 UIPortForwardingTable::UIPortForwardingTable(const UIPortForwardingDataList &rules, bool fIPv6, bool fAllowEmptyGuestIPs)
-    : m_fAllowEmptyGuestIPs(fAllowEmptyGuestIPs)
-    , m_fIsTableDataChanged(false)
+    : m_rules(rules)
+    , m_fIPv6(fIPv6)
+    , m_fAllowEmptyGuestIPs(fAllowEmptyGuestIPs)
+    , m_fTableDataChanged(false)
+    , m_pLayout(0)
     , m_pTableView(0)
     , m_pToolBar(0)
-    , m_pModel(0)
-    , m_pAddAction(0)
-    , m_pCopyAction(0)
-    , m_pDelAction(0)
-{
-    /* Create layout: */
-    QHBoxLayout *pMainLayout = new QHBoxLayout(this);
-    {
-        /* Configure layout: */
-#ifdef VBOX_WS_MAC
-        /* On macOS we can do a bit of smoothness: */
-        pMainLayout->setContentsMargins(0, 0, 0, 0);
-        pMainLayout->setSpacing(3);
-#else
-        pMainLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 3);
-#endif
-        /* Create table: */
-        m_pTableView = new UIPortForwardingView;
-        {
-            /* Configure table: */
-            m_pTableView->setTabKeyNavigation(false);
-            m_pTableView->verticalHeader()->hide();
-            m_pTableView->verticalHeader()->setDefaultSectionSize((int)(m_pTableView->verticalHeader()->minimumSectionSize() * 1.33));
-            m_pTableView->setSelectionMode(QAbstractItemView::SingleSelection);
-            m_pTableView->setContextMenuPolicy(Qt::CustomContextMenu);
-            m_pTableView->installEventFilter(this);
-        }
-        /* Create model: */
-        m_pModel = new UIPortForwardingModel(m_pTableView, rules);
-        {
-            /* Configure model: */
-            connect(m_pModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(sltTableDataChanged()));
-            connect(m_pModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)), this, SLOT(sltTableDataChanged()));
-            connect(m_pModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), this, SLOT(sltTableDataChanged()));
-            /* Configure table (after model is configured): */
-            m_pTableView->setModel(m_pModel);
-            connect(m_pTableView, SIGNAL(sigCurrentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(sltCurrentChanged()));
-            connect(m_pTableView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(sltShowTableContexMenu(const QPoint &)));
-        }
-        /* Create toolbar: */
-        m_pToolBar = new UIToolBar;
-        {
-            /* Determine icon metric: */
-            const QStyle *pStyle = QApplication::style();
-            const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
-            /* Configure toolbar: */
-            m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
-            m_pToolBar->setOrientation(Qt::Vertical);
-            /* Create 'add' action: */
-            m_pAddAction = new QAction(this);
-            {
-                /* Configure 'add' action: */
-                m_pAddAction->setShortcut(QKeySequence("Ins"));
-                m_pAddAction->setIcon(UIIconPool::iconSet(":/controller_add_16px.png", ":/controller_add_disabled_16px.png"));
-                connect(m_pAddAction, SIGNAL(triggered(bool)), this, SLOT(sltAddRule()));
-                m_pToolBar->addAction(m_pAddAction);
-            }
-            /* Create 'copy' action: */
-            m_pCopyAction = new QAction(this);
-            {
-                /* Configure 'add' action: */
-                m_pCopyAction->setIcon(UIIconPool::iconSet(":/controller_add_16px.png", ":/controller_add_disabled_16px.png"));
-                connect(m_pCopyAction, SIGNAL(triggered(bool)), this, SLOT(sltCopyRule()));
-            }
-            /* Create 'del' action: */
-            m_pDelAction = new QAction(this);
-            {
-                /* Configure 'del' action: */
-                m_pDelAction->setShortcut(QKeySequence("Del"));
-                m_pDelAction->setIcon(UIIconPool::iconSet(":/controller_remove_16px.png", ":/controller_remove_disabled_16px.png"));
-                connect(m_pDelAction, SIGNAL(triggered(bool)), this, SLOT(sltDelRule()));
-                m_pToolBar->addAction(m_pDelAction);
-            }
-        }
-        /* Add widgets into layout: */
-        pMainLayout->addWidget(m_pTableView);
-        pMainLayout->addWidget(m_pToolBar);
-    }
-
-    /* We do have abstract item delegate: */
-    QAbstractItemDelegate *pAbstractItemDelegate = m_pTableView->itemDelegate();
-    if (pAbstractItemDelegate)
-    {
-        /* But do we have styled item delegate? */
-        QStyledItemDelegate *pStyledItemDelegate = qobject_cast<QStyledItemDelegate*>(pAbstractItemDelegate);
-        if (pStyledItemDelegate)
-        {
-            /* Create new item editor factory: */
-            QItemEditorFactory *pNewItemEditorFactory = new QItemEditorFactory;
-            {
-                /* Register NameEditor as the NameData editor: */
-                int iNameId = qRegisterMetaType<NameData>();
-                QStandardItemEditorCreator<NameEditor> *pNameEditorItemCreator = new QStandardItemEditorCreator<NameEditor>();
-                pNewItemEditorFactory->registerEditor((QVariant::Type)iNameId, pNameEditorItemCreator);
-
-                /* Register ProtocolEditor as the KNATProtocol editor: */
-                int iProtocolId = qRegisterMetaType<KNATProtocol>();
-                QStandardItemEditorCreator<ProtocolEditor> *pProtocolEditorItemCreator = new QStandardItemEditorCreator<ProtocolEditor>();
-                pNewItemEditorFactory->registerEditor((QVariant::Type)iProtocolId, pProtocolEditorItemCreator);
-
-                /* Register IPv4Editor/IPv6Editor as the IpData editor: */
-                int iIpId = qRegisterMetaType<IpData>();
-                if (!fIPv6)
-                {
-                    QStandardItemEditorCreator<IPv4Editor> *pIPv4EditorItemCreator = new QStandardItemEditorCreator<IPv4Editor>();
-                    pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv4EditorItemCreator);
-                }
-                else
-                {
-                    QStandardItemEditorCreator<IPv6Editor> *pIPv6EditorItemCreator = new QStandardItemEditorCreator<IPv6Editor>();
-                    pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv6EditorItemCreator);
-                }
-
-                /* Register PortEditor as the PortData editor: */
-                int iPortId = qRegisterMetaType<PortData>();
-                QStandardItemEditorCreator<PortEditor> *pPortEditorItemCreator = new QStandardItemEditorCreator<PortEditor>();
-                pNewItemEditorFactory->registerEditor((QVariant::Type)iPortId, pPortEditorItemCreator);
-
-                /* Set newly created item editor factory for table delegate: */
-                pStyledItemDelegate->setItemEditorFactory(pNewItemEditorFactory);
-            }
-        }
-    }
-
-    /* Retranslate dialog: */
-    retranslateUi();
-
-    /* Limit the minimum size to 33% of screen size: */
-    setMinimumSize(gpDesktop->screenGeometry(this).size() / 3);
+    , m_pTableModel(0)
+    , m_pActionAdd(0)
+    , m_pActionCopy(0)
+    , m_pActionRemove(0)
+{
+    /* Prepare: */
+    prepare();
 }
 
 const UIPortForwardingDataList UIPortForwardingTable::rules() const
 {
-    return m_pModel->rules();
+    return m_pTableModel->rules();
 }
 
@@ -955,13 +786,13 @@
     QList<NameData> names;
     QList<UIPortForwardingDataUnique> rules;
-    for (int i = 0; i < m_pModel->rowCount(); ++i)
+    for (int i = 0; i < m_pTableModel->rowCount(); ++i)
     {
         /* Some of variables: */
-        const NameData name = m_pModel->data(m_pModel->index(i, UIPortForwardingDataType_Name), Qt::EditRole).value<NameData>();
-        const KNATProtocol protocol = m_pModel->data(m_pModel->index(i, UIPortForwardingDataType_Protocol), Qt::EditRole).value<KNATProtocol>();
-        const PortData hostPort = m_pModel->data(m_pModel->index(i, UIPortForwardingDataType_HostPort), Qt::EditRole).value<PortData>().value();
-        const PortData guestPort = m_pModel->data(m_pModel->index(i, UIPortForwardingDataType_GuestPort), Qt::EditRole).value<PortData>().value();
-        const IpData hostIp = m_pModel->data(m_pModel->index(i, UIPortForwardingDataType_HostIp), Qt::EditRole).value<IpData>();
-        const IpData guestIp = m_pModel->data(m_pModel->index(i, UIPortForwardingDataType_GuestIp), Qt::EditRole).value<IpData>();
+        const NameData strName = m_pTableModel->data(m_pTableModel->index(i, UIPortForwardingDataType_Name), Qt::EditRole).value<NameData>();
+        const KNATProtocol enmProtocol = m_pTableModel->data(m_pTableModel->index(i, UIPortForwardingDataType_Protocol), Qt::EditRole).value<KNATProtocol>();
+        const PortData hostPort = m_pTableModel->data(m_pTableModel->index(i, UIPortForwardingDataType_HostPort), Qt::EditRole).value<PortData>().value();
+        const PortData guestPort = m_pTableModel->data(m_pTableModel->index(i, UIPortForwardingDataType_GuestPort), Qt::EditRole).value<PortData>().value();
+        const IpData strHostIp = m_pTableModel->data(m_pTableModel->index(i, UIPortForwardingDataType_HostIp), Qt::EditRole).value<IpData>();
+        const IpData strGuestIp = m_pTableModel->data(m_pTableModel->index(i, UIPortForwardingDataType_GuestIp), Qt::EditRole).value<IpData>();
 
         /* If at least one port is 'zero': */
@@ -969,29 +800,29 @@
             return msgCenter().warnAboutIncorrectPort(window());
         /* If at least one address is incorrect: */
-        if (!(   hostIp.trimmed().isEmpty()
-              || RTNetIsIPv4AddrStr(hostIp.toUtf8().constData())
-              || RTNetIsIPv6AddrStr(hostIp.toUtf8().constData())
-              || RTNetStrIsIPv4AddrAny(hostIp.toUtf8().constData())
-              || RTNetStrIsIPv6AddrAny(hostIp.toUtf8().constData())))
+        if (!(   strHostIp.trimmed().isEmpty()
+              || RTNetIsIPv4AddrStr(strHostIp.toUtf8().constData())
+              || RTNetIsIPv6AddrStr(strHostIp.toUtf8().constData())
+              || RTNetStrIsIPv4AddrAny(strHostIp.toUtf8().constData())
+              || RTNetStrIsIPv6AddrAny(strHostIp.toUtf8().constData())))
             return msgCenter().warnAboutIncorrectAddress(window());
-        if (!(   guestIp.trimmed().isEmpty()
-              || RTNetIsIPv4AddrStr(guestIp.toUtf8().constData())
-              || RTNetIsIPv6AddrStr(guestIp.toUtf8().constData())
-              || RTNetStrIsIPv4AddrAny(guestIp.toUtf8().constData())
-              || RTNetStrIsIPv6AddrAny(guestIp.toUtf8().constData())))
+        if (!(   strGuestIp.trimmed().isEmpty()
+              || RTNetIsIPv4AddrStr(strGuestIp.toUtf8().constData())
+              || RTNetIsIPv6AddrStr(strGuestIp.toUtf8().constData())
+              || RTNetStrIsIPv4AddrAny(strGuestIp.toUtf8().constData())
+              || RTNetStrIsIPv6AddrAny(strGuestIp.toUtf8().constData())))
             return msgCenter().warnAboutIncorrectAddress(window());
         /* If empty guest address is not allowed: */
         if (   !m_fAllowEmptyGuestIPs
-            && guestIp.isEmpty())
+            && strGuestIp.isEmpty())
             return msgCenter().warnAboutEmptyGuestAddress(window());
 
         /* Make sure non of the names were previosly used: */
-        if (!names.contains(name))
-            names << name;
+        if (!names.contains(strName))
+            names << strName;
         else
             return msgCenter().warnAboutNameShouldBeUnique(window());
 
         /* Make sure non of the rules were previosly used: */
-        UIPortForwardingDataUnique rule(protocol, hostPort, hostIp);
+        UIPortForwardingDataUnique rule(enmProtocol, hostPort, strHostIp);
         if (!rules.contains(rule))
             rules << rule;
@@ -1006,100 +837,4 @@
 {
     m_pTableView->makeSureEditorDataCommitted();
-}
-
-void UIPortForwardingTable::sltAddRule()
-{
-    m_pModel->addRule(QModelIndex());
-    m_pTableView->setFocus();
-    m_pTableView->setCurrentIndex(m_pModel->index(m_pModel->rowCount() - 1, 0));
-    sltCurrentChanged();
-    sltAdjustTable();
-}
-
-void UIPortForwardingTable::sltCopyRule()
-{
-    m_pModel->addRule(m_pTableView->currentIndex());
-    m_pTableView->setFocus();
-    m_pTableView->setCurrentIndex(m_pModel->index(m_pModel->rowCount() - 1, 0));
-    sltCurrentChanged();
-    sltAdjustTable();
-}
-
-void UIPortForwardingTable::sltDelRule()
-{
-    m_pModel->delRule(m_pTableView->currentIndex());
-    m_pTableView->setFocus();
-    sltCurrentChanged();
-    sltAdjustTable();
-}
-
-void UIPortForwardingTable::sltCurrentChanged()
-{
-    bool fTableFocused = m_pTableView->hasFocus();
-    bool fTableChildFocused = m_pTableView->findChildren<QWidget*>().contains(QApplication::focusWidget());
-    bool fTableOrChildFocused = fTableFocused || fTableChildFocused;
-    m_pCopyAction->setEnabled(m_pTableView->currentIndex().isValid() && fTableOrChildFocused);
-    m_pDelAction->setEnabled(m_pTableView->currentIndex().isValid() && fTableOrChildFocused);
-}
-
-void UIPortForwardingTable::sltShowTableContexMenu(const QPoint &pos)
-{
-    /* Prepare context menu: */
-    QMenu menu(m_pTableView);
-    /* If some index is currently selected: */
-    if (m_pTableView->indexAt(pos).isValid())
-    {
-        menu.addAction(m_pCopyAction);
-        menu.addAction(m_pDelAction);
-    }
-    /* If no valid index selected: */
-    else
-    {
-        menu.addAction(m_pAddAction);
-    }
-    menu.exec(m_pTableView->viewport()->mapToGlobal(pos));
-}
-
-void UIPortForwardingTable::sltAdjustTable()
-{
-    m_pTableView->horizontalHeader()->setStretchLastSection(false);
-    /* If table is NOT empty: */
-    if (m_pModel->rowCount())
-    {
-        /* Resize table to contents size-hint and emit a spare place for first column: */
-        m_pTableView->resizeColumnsToContents();
-        uint uFullWidth = m_pTableView->viewport()->width();
-        for (uint u = 1; u < UIPortForwardingDataType_Max; ++u)
-            uFullWidth -= m_pTableView->horizontalHeader()->sectionSize(u);
-        m_pTableView->horizontalHeader()->resizeSection(UIPortForwardingDataType_Name, uFullWidth);
-    }
-    /* If table is empty: */
-    else
-    {
-        /* Resize table columns to be equal in size: */
-        uint uFullWidth = m_pTableView->viewport()->width();
-        for (uint u = 0; u < UIPortForwardingDataType_Max; ++u)
-            m_pTableView->horizontalHeader()->resizeSection(u, uFullWidth / UIPortForwardingDataType_Max);
-    }
-    m_pTableView->horizontalHeader()->setStretchLastSection(true);
-}
-
-void UIPortForwardingTable::retranslateUi()
-{
-    /* Table translations: */
-    m_pTableView->setWhatsThis(tr("Contains a list of port forwarding rules."));
-
-    /* Set action's text: */
-    m_pAddAction->setText(tr("Add New Rule"));
-    m_pCopyAction->setText(tr("Copy Selected Rule"));
-    m_pDelAction->setText(tr("Remove Selected Rule"));
-
-    m_pAddAction->setWhatsThis(tr("Adds new port forwarding rule."));
-    m_pCopyAction->setWhatsThis(tr("Copies selected port forwarding rule."));
-    m_pDelAction->setWhatsThis(tr("Removes selected port forwarding rule."));
-
-    m_pAddAction->setToolTip(m_pAddAction->whatsThis());
-    m_pCopyAction->setToolTip(m_pCopyAction->whatsThis());
-    m_pDelAction->setToolTip(m_pDelAction->whatsThis());
 }
 
@@ -1134,4 +869,280 @@
 }
 
+void UIPortForwardingTable::retranslateUi()
+{
+    /* Table translations: */
+    m_pTableView->setWhatsThis(tr("Contains a list of port forwarding rules."));
+
+    /* Set action's text: */
+    m_pActionAdd->setText(tr("Add New Rule"));
+    m_pActionCopy->setText(tr("Copy Selected Rule"));
+    m_pActionRemove->setText(tr("Remove Selected Rule"));
+
+    m_pActionAdd->setWhatsThis(tr("Adds new port forwarding rule."));
+    m_pActionCopy->setWhatsThis(tr("Copies selected port forwarding rule."));
+    m_pActionRemove->setWhatsThis(tr("Removes selected port forwarding rule."));
+
+    m_pActionAdd->setToolTip(m_pActionAdd->whatsThis());
+    m_pActionCopy->setToolTip(m_pActionCopy->whatsThis());
+    m_pActionRemove->setToolTip(m_pActionRemove->whatsThis());
+}
+
+void UIPortForwardingTable::sltAddRule()
+{
+    m_pTableModel->addRule(QModelIndex());
+    m_pTableView->setFocus();
+    m_pTableView->setCurrentIndex(m_pTableModel->index(m_pTableModel->rowCount() - 1, 0));
+    sltCurrentChanged();
+    sltAdjustTable();
+}
+
+void UIPortForwardingTable::sltCopyRule()
+{
+    m_pTableModel->addRule(m_pTableView->currentIndex());
+    m_pTableView->setFocus();
+    m_pTableView->setCurrentIndex(m_pTableModel->index(m_pTableModel->rowCount() - 1, 0));
+    sltCurrentChanged();
+    sltAdjustTable();
+}
+
+void UIPortForwardingTable::sltRemoveRule()
+{
+    m_pTableModel->removeRule(m_pTableView->currentIndex());
+    m_pTableView->setFocus();
+    sltCurrentChanged();
+    sltAdjustTable();
+}
+
+void UIPortForwardingTable::sltCurrentChanged()
+{
+    bool fTableFocused = m_pTableView->hasFocus();
+    bool fTableChildFocused = m_pTableView->findChildren<QWidget*>().contains(QApplication::focusWidget());
+    bool fTableOrChildFocused = fTableFocused || fTableChildFocused;
+    m_pActionCopy->setEnabled(m_pTableView->currentIndex().isValid() && fTableOrChildFocused);
+    m_pActionRemove->setEnabled(m_pTableView->currentIndex().isValid() && fTableOrChildFocused);
+}
+
+void UIPortForwardingTable::sltShowTableContexMenu(const QPoint &pos)
+{
+    /* Prepare context menu: */
+    QMenu menu(m_pTableView);
+    /* If some index is currently selected: */
+    if (m_pTableView->indexAt(pos).isValid())
+    {
+        menu.addAction(m_pActionCopy);
+        menu.addAction(m_pActionRemove);
+    }
+    /* If no valid index selected: */
+    else
+    {
+        menu.addAction(m_pActionAdd);
+    }
+    menu.exec(m_pTableView->viewport()->mapToGlobal(pos));
+}
+
+void UIPortForwardingTable::sltAdjustTable()
+{
+    m_pTableView->horizontalHeader()->setStretchLastSection(false);
+    /* If table is NOT empty: */
+    if (m_pTableModel->rowCount())
+    {
+        /* Resize table to contents size-hint and emit a spare place for first column: */
+        m_pTableView->resizeColumnsToContents();
+        uint uFullWidth = m_pTableView->viewport()->width();
+        for (uint u = 1; u < UIPortForwardingDataType_Max; ++u)
+            uFullWidth -= m_pTableView->horizontalHeader()->sectionSize(u);
+        m_pTableView->horizontalHeader()->resizeSection(UIPortForwardingDataType_Name, uFullWidth);
+    }
+    /* If table is empty: */
+    else
+    {
+        /* Resize table columns to be equal in size: */
+        uint uFullWidth = m_pTableView->viewport()->width();
+        for (uint u = 0; u < UIPortForwardingDataType_Max; ++u)
+            m_pTableView->horizontalHeader()->resizeSection(u, uFullWidth / UIPortForwardingDataType_Max);
+    }
+    m_pTableView->horizontalHeader()->setStretchLastSection(true);
+}
+
+void UIPortForwardingTable::prepare()
+{
+    /* Prepare layout: */
+    prepareLayout();
+
+    /* Apply language settings: */
+    retranslateUi();
+
+    /* Limit the minimum size to 33% of screen size: */
+    setMinimumSize(gpDesktop->screenGeometry(this).size() / 3);
+}
+
+void UIPortForwardingTable::prepareLayout()
+{
+    /* Create layout: */
+    m_pLayout = new QHBoxLayout(this);
+    if (m_pLayout)
+    {
+        /* Configure layout: */
+#ifdef VBOX_WS_MAC
+        /* On macOS we can do a bit of smoothness: */
+        m_pLayout->setContentsMargins(0, 0, 0, 0);
+        m_pLayout->setSpacing(3);
+#else
+        m_pLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 3);
+#endif
+
+        /* Prepare table-view: */
+        prepareTableView();
+
+        /* Prepare toolbar: */
+        prepareToolbar();
+    }
+}
+
+void UIPortForwardingTable::prepareTableView()
+{
+    /* Create table-view: */
+    m_pTableView = new UIPortForwardingView;
+    if (m_pTableView)
+    {
+        /* Configure table-view: */
+        m_pTableView->setTabKeyNavigation(false);
+        m_pTableView->verticalHeader()->hide();
+        m_pTableView->verticalHeader()->setDefaultSectionSize((int)(m_pTableView->verticalHeader()->minimumSectionSize() * 1.33));
+        m_pTableView->setSelectionMode(QAbstractItemView::SingleSelection);
+        m_pTableView->setContextMenuPolicy(Qt::CustomContextMenu);
+        m_pTableView->installEventFilter(this);
+
+        /* Prepare model: */
+        prepareTableModel();
+
+        /* Finish configure table-view (after model is configured): */
+        m_pTableView->setModel(m_pTableModel);
+        connect(m_pTableView, SIGNAL(sigCurrentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(sltCurrentChanged()));
+        connect(m_pTableView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(sltShowTableContexMenu(const QPoint &)));
+
+        /* Prepare delegates: */
+        prepareTableDelegates();
+
+        /* Add into layout: */
+        m_pLayout->addWidget(m_pTableView);
+    }
+}
+
+void UIPortForwardingTable::prepareTableModel()
+{
+    /* Create table-model: */
+    m_pTableModel = new UIPortForwardingModel(m_pTableView, m_rules);
+    if (m_pTableModel)
+    {
+        /* Configure table-model: */
+        connect(m_pTableModel, &UIPortForwardingModel::dataChanged,
+                this, &UIPortForwardingTable::sltTableDataChanged);
+        connect(m_pTableModel, &UIPortForwardingModel::rowsInserted,
+                this, &UIPortForwardingTable::sltTableDataChanged);
+        connect(m_pTableModel, &UIPortForwardingModel::rowsRemoved,
+                this, &UIPortForwardingTable::sltTableDataChanged);
+    }
+}
+
+void UIPortForwardingTable::prepareTableDelegates()
+{
+    /* We certainly have abstract item delegate: */
+    QAbstractItemDelegate *pAbstractItemDelegate = m_pTableView->itemDelegate();
+    if (pAbstractItemDelegate)
+    {
+        /* But is this also styled item delegate? */
+        QStyledItemDelegate *pStyledItemDelegate = qobject_cast<QStyledItemDelegate*>(pAbstractItemDelegate);
+        if (pStyledItemDelegate)
+        {
+            /* Create new item editor factory: */
+            QItemEditorFactory *pNewItemEditorFactory = new QItemEditorFactory;
+            if (pNewItemEditorFactory)
+            {
+                /* Register NameEditor as the NameData editor: */
+                int iNameId = qRegisterMetaType<NameData>();
+                QStandardItemEditorCreator<NameEditor> *pNameEditorItemCreator = new QStandardItemEditorCreator<NameEditor>();
+                pNewItemEditorFactory->registerEditor((QVariant::Type)iNameId, pNameEditorItemCreator);
+
+                /* Register ProtocolEditor as the KNATProtocol editor: */
+                int iProtocolId = qRegisterMetaType<KNATProtocol>();
+                QStandardItemEditorCreator<ProtocolEditor> *pProtocolEditorItemCreator = new QStandardItemEditorCreator<ProtocolEditor>();
+                pNewItemEditorFactory->registerEditor((QVariant::Type)iProtocolId, pProtocolEditorItemCreator);
+
+                /* Register IPv4Editor/IPv6Editor as the IpData editor: */
+                int iIpId = qRegisterMetaType<IpData>();
+                if (!m_fIPv6)
+                {
+                    QStandardItemEditorCreator<IPv4Editor> *pIPv4EditorItemCreator = new QStandardItemEditorCreator<IPv4Editor>();
+                    pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv4EditorItemCreator);
+                }
+                else
+                {
+                    QStandardItemEditorCreator<IPv6Editor> *pIPv6EditorItemCreator = new QStandardItemEditorCreator<IPv6Editor>();
+                    pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv6EditorItemCreator);
+                }
+
+                /* Register PortEditor as the PortData editor: */
+                int iPortId = qRegisterMetaType<PortData>();
+                QStandardItemEditorCreator<PortEditor> *pPortEditorItemCreator = new QStandardItemEditorCreator<PortEditor>();
+                pNewItemEditorFactory->registerEditor((QVariant::Type)iPortId, pPortEditorItemCreator);
+
+                /* Set newly created item editor factory for table delegate: */
+                pStyledItemDelegate->setItemEditorFactory(pNewItemEditorFactory);
+            }
+        }
+    }
+}
+
+void UIPortForwardingTable::prepareToolbar()
+{
+    /* Create toolbar: */
+    m_pToolBar = new UIToolBar;
+    if (m_pToolBar)
+    {
+        /* Determine icon metric: */
+        const QStyle *pStyle = QApplication::style();
+        const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
+
+        /* Configure toolbar: */
+        m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
+        m_pToolBar->setOrientation(Qt::Vertical);
+
+        /* Create 'Add' action: */
+        m_pActionAdd = new QAction(this);
+        if (m_pActionAdd)
+        {
+            /* Configure action: */
+            m_pActionAdd->setShortcut(QKeySequence("Ins"));
+            m_pActionAdd->setIcon(UIIconPool::iconSet(":/controller_add_16px.png", ":/controller_add_disabled_16px.png"));
+            connect(m_pActionAdd, SIGNAL(triggered(bool)), this, SLOT(sltAddRule()));
+            m_pToolBar->addAction(m_pActionAdd);
+        }
+
+        /* Create 'Copy' action: */
+        m_pActionCopy = new QAction(this);
+        if (m_pActionCopy)
+        {
+            /* Configure action: */
+            m_pActionCopy->setIcon(UIIconPool::iconSet(":/controller_add_16px.png", ":/controller_add_disabled_16px.png"));
+            connect(m_pActionCopy, SIGNAL(triggered(bool)), this, SLOT(sltCopyRule()));
+        }
+
+        /* Create 'Remove' action: */
+        m_pActionRemove = new QAction(this);
+        if (m_pActionRemove)
+        {
+            /* Configure action: */
+            m_pActionRemove->setShortcut(QKeySequence("Del"));
+            m_pActionRemove->setIcon(UIIconPool::iconSet(":/controller_remove_16px.png", ":/controller_remove_disabled_16px.png"));
+            connect(m_pActionRemove, SIGNAL(triggered(bool)), this, SLOT(sltRemoveRule()));
+            m_pToolBar->addAction(m_pActionRemove);
+        }
+
+        /* Add into layout: */
+        m_pLayout->addWidget(m_pToolBar);
+    }
+}
+
+
 #include "UIPortForwardingTable.moc"
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.h	(revision 71936)
+++ trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.h	(revision 71937)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2010-2017 Oracle Corporation
+ * Copyright (C) 2010-2018 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -16,12 +16,14 @@
  */
 
-#ifndef __UIPortForwardingTable_h__
-#define __UIPortForwardingTable_h__
+#ifndef ___UIPortForwardingTable_h___
+#define ___UIPortForwardingTable_h___
 
 /* Qt includes: */
+#include <QString>
 #include <QWidget>
 
 /* GUI includes: */
 #include "QIWithRetranslateUI.h"
+#include "UILibraryDefs.h"
 
 /* COM includes: */
@@ -29,47 +31,65 @@
 
 /* Forward declarations: */
+class QAction;
+class QHBoxLayout;
+class QIDialogButtonBox;
 class QITableView;
+class UIPortForwardingModel;
 class UIToolBar;
-class QIDialogButtonBox;
-class UIPortForwardingModel;
-
-/* Name data: */
+
+
+/** QString subclass used to distinguish name data from simple QString. */
 class NameData : public QString
 {
 public:
 
+    /** Constructs null name data. */
     NameData() : QString() {}
+    /** Constructs name data passing @a strName to the base-class. */
     NameData(const QString &strName) : QString(strName) {}
 };
 Q_DECLARE_METATYPE(NameData);
 
-/* Ip data: */
+
+/** QString subclass used to distinguish IP data from simple QString. */
 class IpData : public QString
 {
 public:
 
+    /** Constructs null IP data. */
     IpData() : QString() {}
-    IpData(const QString &strIP) : QString(strIP) {}
+    /** Constructs name data passing @a strIp to the base-class. */
+    IpData(const QString &strIp) : QString(strIp) {}
 };
 Q_DECLARE_METATYPE(IpData);
 
-/* Port data: */
+
+/** Wrapper for ushort used to distinguish port data from simple ushort. */
 class PortData
 {
 public:
 
+    /** Constructs null port data. */
     PortData() : m_uValue(0) {}
+    /** Constructs port data based on @a uValue. */
     PortData(ushort uValue) : m_uValue(uValue) {}
+    /** Constructs port data based on @a other port data value. */
     PortData(const PortData &other) : m_uValue(other.value()) {}
-    bool operator==(const PortData &other) const { return m_uValue == other.m_uValue; }
+
+    /** Returns whether this port data is equal to @a another. */
+    bool operator==(const PortData &another) const { return m_uValue == another.m_uValue; }
+
+    /** Returns serialized port data value. */
     ushort value() const { return m_uValue; }
 
 private:
 
+    /** Holds the port data value. */
     ushort m_uValue;
 };
 Q_DECLARE_METATYPE(PortData);
 
-/** Port Forwarding Rule data structure. */
+
+/** Port Forwarding Rule structure. */
 struct UIDataPortForwardingRule
 {
@@ -137,7 +157,13 @@
 };
 
-/* Port forwarding data, unique part: */
+/** Port Forwarding Data list. */
+typedef QList<UIDataPortForwardingRule> UIPortForwardingDataList;
+
+
+/** Unique part of port forwarding data. */
 struct UIPortForwardingDataUnique
 {
+    /** Constructs unique port forwarding data based on
+      * @a enmProtocol, @a uHostPort and @a uHostPort. */
     UIPortForwardingDataUnique(KNATProtocol enmProtocol,
                                PortData uHostPort,
@@ -145,23 +171,28 @@
         : protocol(enmProtocol)
         , hostPort(uHostPort)
-        , hostIp(strHostIp) {}
-    bool operator==(const UIPortForwardingDataUnique &other)
+        , hostIp(strHostIp)
+    {}
+
+    /** Returns whether this port data is equal to @a another. */
+    bool operator==(const UIPortForwardingDataUnique &another)
     {
-        return    protocol == other.protocol
-               && hostPort == other.hostPort
-               && (   hostIp.isEmpty()    || other.hostIp.isEmpty()
-                   || hostIp == "0.0.0.0" || other.hostIp == "0.0.0.0"
-                   || hostIp              == other.hostIp);
+        return    protocol == another.protocol
+               && hostPort == another.hostPort
+               && (   hostIp.isEmpty()    || another.hostIp.isEmpty()
+                   || hostIp == "0.0.0.0" || another.hostIp == "0.0.0.0"
+                   || hostIp              == another.hostIp);
     }
+
+    /** Holds the port forwarding data protocol type. */
     KNATProtocol protocol;
+    /** Holds the port forwarding data host port. */
     PortData hostPort;
+    /** Holds the port forwarding data host IP. */
     IpData hostIp;
 };
 
-/* Port forwarding data list: */
-typedef QList<UIDataPortForwardingRule> UIPortForwardingDataList;
-
-/* Port forwarding dialog: */
-class UIPortForwardingTable : public QIWithRetranslateUI<QWidget>
+
+/** QWidget subclass representig Port Forwarding table. */
+class SHARED_LIBRARY_STUFF UIPortForwardingTable : public QIWithRetranslateUI<QWidget>
 {
     Q_OBJECT;
@@ -169,58 +200,92 @@
 public:
 
-    /* Constructor: */
+    /** Constructs Port Forwarding table.
+      * @param  rules                Brings the current list of Port Forwarding rules.
+      * @param  fIPv6                Brings whether this table contains IPv6 rules, not IPv4.
+      * @param  fAllowEmptyGuestIPs  Brings whether this table allows empty guest IPs. */
     UIPortForwardingTable(const UIPortForwardingDataList &rules, bool fIPv6, bool fAllowEmptyGuestIPs);
 
-    /* API: Rules stuff: */
+    /** Returns the list of port forwarding rules. */
     const UIPortForwardingDataList rules() const;
+
+    /** Validates the table. */
     bool validate() const;
 
     /** Returns whether the table data was changed. */
-    bool isChanged() const { return m_fIsTableDataChanged; }
+    bool isChanged() const { return m_fTableDataChanged; }
 
     /** Makes sure current editor data committed. */
     void makeSureEditorDataCommitted();
 
+protected:
+
+    /** Preprocesses any Qt @a pEvent for passed @a pObject. */
+    virtual bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */;
+
+    /** Handles translation event. */
+    virtual void retranslateUi() /* override */;
+
 private slots:
 
-    /* Handlers: Table operation stuff: */
+    /** Adds the rule. */
     void sltAddRule();
+    /** Copies the rule. */
     void sltCopyRule();
-    void sltDelRule();
+    /** Removes the rule. */
+    void sltRemoveRule();
 
     /** Marks table data as changed. */
-    void sltTableDataChanged() { m_fIsTableDataChanged = true; }
-
-    /* Handlers: Table stuff: */
+    void sltTableDataChanged() { m_fTableDataChanged = true; }
+
+    /** Handles current item change. */
     void sltCurrentChanged();
+    /** Handles request to show context-menu in certain @a position. */
     void sltShowTableContexMenu(const QPoint &position);
+    /** Adjusts table column sizes. */
     void sltAdjustTable();
 
 private:
 
-    /* Handler: Translation stuff: */
-    void retranslateUi();
-
-    /* Handlers: Event-processing stuff: */
-    bool eventFilter(QObject *pObject, QEvent *pEvent);
-
-    /* Flags: */
-    bool m_fAllowEmptyGuestIPs;
-
-    /** Holds whether the table data was changed. */
-    bool m_fIsTableDataChanged;
-
-    /* Widgets: */
+    /** Prepares all. */
+    void prepare();
+    /** Prepares layout. */
+    void prepareLayout();
+    /** Prepares table-view. */
+    void prepareTableView();
+    /** Prepares table-model. */
+    void prepareTableModel();
+    /** Prepares table-delegates. */
+    void prepareTableDelegates();
+    /** Prepares toolbar. */
+    void prepareToolbar();
+
+    /** Holds the _initial_ list of Port Forwarding rules. */
+    const UIPortForwardingDataList &m_rules;
+
+    /** Holds whether this table contains IPv6 rules, not IPv4. */
+    bool  m_fIPv6               : 1;
+    /** Holds whether this table allows empty guest IPs. */
+    bool  m_fAllowEmptyGuestIPs : 1;
+    /** Holds whether this table data was changed. */
+    bool  m_fTableDataChanged   : 1;
+
+    /** Holds the layout instance. */
+    QHBoxLayout *m_pLayout;
+    /** Holds the table-view instance. */
     QITableView *m_pTableView;
-    UIToolBar *m_pToolBar;
-
-    /* Model: */
-    UIPortForwardingModel *m_pModel;
-
-    /* Actions: */
-    QAction *m_pAddAction;
-    QAction *m_pCopyAction;
-    QAction *m_pDelAction;
-};
-
-#endif // __UIPortForwardingTable_h__
+    /** Holds the tool-bar instance. */
+    UIToolBar   *m_pToolBar;
+
+    /** Holds the table-model instance. */
+    UIPortForwardingModel *m_pTableModel;
+
+    /** Holds the Add action instance. */
+    QAction *m_pActionAdd;
+    /** Holds the Copy action instance. */
+    QAction *m_pActionCopy;
+    /** Holds the Remove action instance. */
+    QAction *m_pActionRemove;
+};
+
+
+#endif /* !___UIPortForwardingTable_h___ */
