Index: trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 18377)
+++ trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 18378)
@@ -242,4 +242,5 @@
 	include/VBoxOSTypeSelectorButton.h \
 	include/VBoxOSTypeSelectorWidget.h \
+	include/VBoxLineTextEdit.h \
 	include/VBoxUtils.h \
 	include/VBoxGlobalSettings.h \
@@ -291,6 +292,8 @@
 	include/VBoxSettingsPage.h \
 	include/VBoxSettingsSelector.h \
+	include/VBoxApplianceEditorWgt.h \
 	include/VBoxImportApplianceWgt.h \
 	include/VBoxImportApplianceWzd.h \
+	include/VBoxExportApplianceWgt.h \
 	include/VBoxExportApplianceWzd.h
 
@@ -327,4 +330,5 @@
 	src/VBoxOSTypeSelectorButton.cpp \
 	src/VBoxOSTypeSelectorWidget.cpp \
+	src/VBoxLineTextEdit.cpp \
 	src/VBoxDefs.cpp \
 	src/VBoxGlobalSettings.cpp \
@@ -377,6 +381,8 @@
 	src/VBoxMediaManagerDlg.cpp \
 	src/VBoxMedium.cpp \
+	src/VBoxApplianceEditorWgt.cpp \
 	src/VBoxImportApplianceWgt.cpp \
 	src/VBoxImportApplianceWzd.cpp \
+	src/VBoxExportApplianceWgt.cpp \
 	src/VBoxExportApplianceWzd.cpp
 
Index: trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro	(revision 18377)
+++ trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro	(revision 18378)
@@ -59,5 +59,5 @@
     ui/VBoxGLSettingsNetwork.ui \
     ui/VBoxGLSettingsNetworkDetails.ui \
-    ui/VBoxImportApplianceWgt.ui \
+    ui/VBoxApplianceEditorWgt.ui \
     ui/VBoxImportApplianceWzd.ui \
     ui/VBoxExportApplianceWzd.ui
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxApplianceEditorWgt.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxApplianceEditorWgt.h	(revision 18378)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxApplianceEditorWgt.h	(revision 18378)
@@ -0,0 +1,259 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxApplianceEditorWgt class declaration
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxApplianceEditorWgt_h__
+#define __VBoxApplianceEditorWgt_h__
+
+/* VBox includes */
+#include "COMDefs.h"
+#include "VBoxApplianceEditorWgt.gen.h"
+#include "QIWithRetranslateUI.h"
+
+/* Qt includes */
+#include <QSortFilterProxyModel>
+#include <QItemDelegate>
+
+/* VBox forward declarations */
+class ModelItem;
+
+////////////////////////////////////////////////////////////////////////////////
+// Globals
+
+enum TreeViewSection { DescriptionSection = 0, OriginalValueSection, ConfigValueSection };
+
+////////////////////////////////////////////////////////////////////////////////
+// ModelItem
+
+enum ModelItemType { RootType, VirtualSystemType, HardwareType };
+
+/* This & the following derived classes represent the data items of a Virtual
+   System. All access/manipulation is done with the help of virtual functions
+   to keep the interface clean. ModelItem is able to handle tree structures
+   with a parent & several children's. */
+class ModelItem
+{
+public:
+    ModelItem (int aNumber, ModelItemType aType, ModelItem *aParent = NULL);
+
+    ~ModelItem();
+
+    ModelItem *parent() const { return mParentItem; }
+
+    void appendChild (ModelItem *aChild);
+    ModelItem * child (int aRow) const;
+
+    int row() const;
+
+    int childCount() const;
+    int columnCount() const { return 3; }
+
+    virtual Qt::ItemFlags itemFlags (int /* aColumn */) const { return 0; }
+    virtual bool setData (int /* aColumn */, const QVariant & /* aValue */, int /* aRole */) { return false; }
+    virtual QVariant data (int /* aColumn */, int /* aRole */) const { return QVariant(); }
+    virtual QWidget * createEditor (QWidget * /* aParent */, const QStyleOptionViewItem & /* aOption */, const QModelIndex & /* aIndex */) const { return NULL; }
+    virtual bool setEditorData (QWidget * /* aEditor */, const QModelIndex & /* aIndex */) const { return false; }
+    virtual bool setModelData (QWidget * /* aEditor */, QAbstractItemModel * /* aModel */, const QModelIndex & /* aIndex */) { return false; }
+
+    virtual void restoreDefaults() {}
+    virtual void putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues);
+
+    ModelItemType type() const { return mType; }
+
+protected:
+    /* Protected member vars */
+    int mNumber;
+    ModelItemType mType;
+
+    ModelItem *mParentItem;
+    QList<ModelItem*> mChildItems;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// VirtualSystemItem
+
+/* This class represent a Virtual System with an index. */
+class VirtualSystemItem: public ModelItem
+{
+public:
+    VirtualSystemItem (int aNumber, CVirtualSystemDescription aDesc, ModelItem *aParent);
+
+    virtual QVariant data (int aColumn, int aRole) const;
+
+    virtual void putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues);
+
+private:
+    CVirtualSystemDescription mDesc;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// HardwareItem
+
+/* This class represent an hardware item of a Virtual System. All values of
+   KVirtualSystemDescriptionType are supported & handled differently. */
+class HardwareItem: public ModelItem
+{
+    friend class VirtualSystemSortProxyModel;
+public:
+
+    HardwareItem (int aNumber,
+                  KVirtualSystemDescriptionType aType,
+                  const QString &aRef,
+                  const QString &aOrigValue,
+                  const QString &aConfigValue,
+                  const QString &aExtraConfigValue,
+                  ModelItem *aParent);
+
+    virtual void putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues);
+
+    virtual bool setData (int aColumn, const QVariant &aValue, int aRole);
+    virtual QVariant data (int aColumn, int aRole) const;
+
+    virtual Qt::ItemFlags itemFlags (int aColumn) const;
+
+    virtual QWidget * createEditor (QWidget *aParent, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const;
+    virtual bool setEditorData (QWidget *aEditor, const QModelIndex &aIndex) const;
+
+    virtual bool setModelData (QWidget *aEditor, QAbstractItemModel *aModel, const QModelIndex &aIndex);
+
+    virtual void restoreDefaults()
+    {
+        mConfigValue = mConfigDefaultValue;
+        mCheckState = Qt::Checked;
+    }
+
+private:
+
+    /* Private member vars */
+    KVirtualSystemDescriptionType mType;
+    QString mRef;
+    QString mOrigValue;
+    QString mConfigValue;
+    QString mConfigDefaultValue;
+    QString mExtraConfigValue;
+    Qt::CheckState mCheckState;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// VirtualSystemModel
+
+class VirtualSystemModel: public QAbstractItemModel
+{
+
+public:
+    VirtualSystemModel (QVector<CVirtualSystemDescription>& aVSDs, QObject *aParent = NULL);
+
+    QModelIndex index (int aRow, int aColumn, const QModelIndex &aParent = QModelIndex()) const;
+    QModelIndex parent (const QModelIndex &aIndex) const;
+    int rowCount (const QModelIndex &aParent = QModelIndex()) const;
+    int columnCount (const QModelIndex &aParent = QModelIndex()) const;
+    bool setData (const QModelIndex &aIndex, const QVariant &aValue, int aRole);
+    QVariant data (const QModelIndex &aIndex, int aRole = Qt::DisplayRole) const;
+    Qt::ItemFlags flags (const QModelIndex &aIndex) const;
+    QVariant headerData (int aSection, Qt::Orientation aOrientation, int aRole) const;
+
+    void restoreDefaults (const QModelIndex& aParent = QModelIndex());
+    void putBack();
+
+private:
+    /* Private member vars */
+    ModelItem *mRootItem;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// VirtualSystemDelegate
+
+/* The delegate is used for creating/handling the different editors for the
+   various types we support. This class forward the requests to the virtual
+   methods of our different ModelItems. If this is not possible the default
+   methods of QItemDelegate are used to get some standard behavior. Note: We
+   have to handle the proxy model ourself. I really don't understand why Qt is
+   not doing this for us. */
+class VirtualSystemDelegate: public QItemDelegate
+{
+public:
+    VirtualSystemDelegate (QAbstractProxyModel *aProxy, QObject *aParent = NULL);
+
+    QWidget * createEditor (QWidget *aParent, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const;
+    void setEditorData (QWidget *aEditor, const QModelIndex &aIndex) const;
+    void setModelData (QWidget *aEditor, QAbstractItemModel *aModel, const QModelIndex &aIndex) const;
+    void updateEditorGeometry (QWidget *aEditor, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const;
+
+    QSize sizeHint (const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const
+    {
+        QSize size = QItemDelegate::sizeHint (aOption, aIndex);
+#ifdef Q_WS_MAC
+        int h = 28;
+#else /* Q_WS_MAC */
+        int h = 24;
+#endif /* Q_WS_MAC */
+        size.setHeight (RT_MAX (h, size.height()));
+        return size;
+    }
+private:
+    /* Private member vars */
+    QAbstractProxyModel *mProxy;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// VirtualSystemSortProxyModel
+
+class VirtualSystemSortProxyModel: public QSortFilterProxyModel
+{
+public:
+    VirtualSystemSortProxyModel (QObject *aParent = NULL);
+
+protected:
+    bool filterAcceptsRow (int aSourceRow, const QModelIndex & aSourceParent) const;
+    bool lessThan (const QModelIndex &aLeft, const QModelIndex &aRight) const;
+
+    static KVirtualSystemDescriptionType mSortList[];
+
+    QList<KVirtualSystemDescriptionType> mFilterList;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// VBoxApplianceEditorWgt
+
+class VBoxApplianceEditorWgt : public QIWithRetranslateUI<QWidget>,
+                               public Ui::VBoxApplianceEditorWgt
+{
+    Q_OBJECT;
+
+public:
+    VBoxApplianceEditorWgt (QWidget *aParent = NULL);
+
+    bool isValid() const { return mAppliance != NULL; }
+    CAppliance* appliance() const { return mAppliance; }
+
+public slots:
+    void restoreDefaults();
+
+protected:
+    virtual void retranslateUi();
+
+    /* Protected member vars */
+    CAppliance *mAppliance;
+    VirtualSystemModel *mModel;
+};
+
+#endif /* __VBoxApplianceEditorWgt_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxExportApplianceWgt.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxExportApplianceWgt.h	(revision 18378)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxExportApplianceWgt.h	(revision 18378)
@@ -0,0 +1,40 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxExportApplianceWgt class declaration
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxExportApplianceWgt_h__
+#define __VBoxExportApplianceWgt_h__
+
+#include "VBoxApplianceEditorWgt.h"
+
+class VBoxExportApplianceWgt : public VBoxApplianceEditorWgt
+{
+public:
+    VBoxExportApplianceWgt (QWidget *aParent = NULL);
+
+    CAppliance* init();
+
+    void populate();
+    void prepareExport();
+};
+
+#endif /* __VBoxExportApplianceWgt_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxExportApplianceWzd.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxExportApplianceWzd.h	(revision 18377)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxExportApplianceWzd.h	(revision 18378)
@@ -53,5 +53,5 @@
 private:
     void addListViewVMItems (const QString& aSelectName);
-    bool prepareForExportVMs (CAppliance &aAppliance);
+    bool prepareSettingsWidget();
     bool exportVMs (CAppliance &aAppliance);
 
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxImportApplianceWgt.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxImportApplianceWgt.h	(revision 18377)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxImportApplianceWgt.h	(revision 18378)
@@ -24,12 +24,8 @@
 #define __VBoxImportApplianceWgt_h__
 
-#include "VBoxImportApplianceWgt.gen.h"
-#include "QIWithRetranslateUI.h"
+/* VBox includes */
+#include "VBoxApplianceEditorWgt.h"
 
-class CAppliance;
-class VirtualSystemModel;
-
-class VBoxImportApplianceWgt : public QIWithRetranslateUI<QWidget>,
-                               public Ui::VBoxImportApplianceWgt
+class VBoxImportApplianceWgt : public VBoxApplianceEditorWgt
 {
     Q_OBJECT;
@@ -42,5 +38,4 @@
     bool import();
 
-    bool isValid() const { return mAppliance != NULL; }
     QList < QPair <QString, QString> > licenseAgreements() const;
 
@@ -50,17 +45,8 @@
     static int maxGuestCPUCount() { return mMaxGuestCPUCount; }
 
-public slots:
-    void restoreDefaults();
-
-protected:
-    void retranslateUi();
-
 private:
     static void initSystemSettings();
 
     /* Private member vars */
-    CAppliance *mAppliance;
-    VirtualSystemModel *mModel;
-
     static int mMinGuestRAM;
     static int mMaxGuestRAM;
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxLineTextEdit.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxLineTextEdit.h	(revision 18378)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxLineTextEdit.h	(revision 18378)
@@ -0,0 +1,88 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxLineTextEdit class declaration
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxLineTextEdit_h__
+#define __VBoxLineTextEdit_h__
+
+/* VBox includes */
+#include "QIDialog.h"
+#include "QIWithRetranslateUI.h"
+
+/* Qt includes */
+#include <QPushButton>
+
+/* Qt forward declarations */
+class QTextEdit;
+class QDialogButtonBox;
+
+////////////////////////////////////////////////////////////////////////////////
+// VBoxTextEditor
+
+class VBoxTextEditor: public QIWithRetranslateUI<QIDialog>
+{
+    Q_OBJECT;
+
+public:
+    VBoxTextEditor (QWidget *aParent = NULL);
+
+    void setText (const QString& aText);
+    QString text() const;
+
+protected:
+    void retranslateUi();
+
+private slots:
+    void open();
+
+private:
+    /* Private member vars */
+    QTextEdit *mTextEdit;
+    QDialogButtonBox *mButtonBox;
+    QPushButton *mOpenBtn;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// VBoxLineTextEdit
+
+class VBoxLineTextEdit: public QIWithRetranslateUI<QPushButton>
+{
+    Q_OBJECT;
+
+public:
+    VBoxLineTextEdit (QWidget *aParent = NULL);
+
+    void setText (const QString& aText) { mText = aText; }
+    QString text() const { return mText; }
+
+protected:
+    void retranslateUi();
+
+private slots:
+    void edit();
+
+private:
+    /* Private member vars */
+    QString mText;
+};
+
+#endif /* __VBoxLineTextEdit_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxApplianceEditorWgt.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxApplianceEditorWgt.cpp	(revision 18378)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxApplianceEditorWgt.cpp	(revision 18378)
@@ -0,0 +1,991 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxApplianceEditorWgt class implementation
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+/* VBox includes */
+#include "VBoxApplianceEditorWgt.h"
+#include "VBoxImportApplianceWzd.h"
+#include "VBoxGlobal.h"
+#include "VBoxProblemReporter.h"
+#include "VBoxFilePathSelectorWidget.h"
+#include "VBoxOSTypeSelectorButton.h"
+#include "VBoxLineTextEdit.h"
+
+/* Qt includes */
+#include <QItemDelegate>
+#include <QSortFilterProxyModel>
+#include <QHeaderView>
+#include <QLineEdit>
+#include <QTextEdit>
+#include <QSpinBox>
+#include <QComboBox>
+
+////////////////////////////////////////////////////////////////////////////////
+// ModelItem
+
+/* This & the following derived classes represent the data items of a Virtual
+   System. All access/manipulation is done with the help of virtual functions
+   to keep the interface clean. ModelItem is able to handle tree structures
+   with a parent & several children's. */
+ModelItem::ModelItem (int aNumber, ModelItemType aType, ModelItem *aParent /* = NULL */)
+  : mNumber (aNumber)
+  , mType (aType)
+  , mParentItem (aParent)
+{}
+
+ModelItem::~ModelItem()
+{
+    qDeleteAll (mChildItems);
+}
+
+void ModelItem::appendChild (ModelItem *aChild)
+{
+    AssertPtr (aChild);
+    mChildItems << aChild;
+}
+
+ModelItem * ModelItem::child (int aRow) const
+{
+    return mChildItems.value (aRow);
+}
+
+int ModelItem::row() const
+{
+    if (mParentItem)
+        return mParentItem->mChildItems.indexOf (const_cast<ModelItem*> (this));
+
+    return 0;
+}
+
+int ModelItem::childCount() const
+{
+    return mChildItems.count();
+}
+
+void ModelItem::putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues)
+{
+    for (int i = 0; i < childCount(); ++i)
+        child (i)->putBack (aFinalStates, aFinalValues, aFinalExtraValues);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// VirtualSystemItem
+
+VirtualSystemItem::VirtualSystemItem (int aNumber, CVirtualSystemDescription aDesc, ModelItem *aParent)
+  : ModelItem (aNumber, VirtualSystemType, aParent)
+  , mDesc (aDesc)
+{}
+
+QVariant VirtualSystemItem::data (int aColumn, int aRole) const
+{
+    QVariant v;
+    if (aColumn == DescriptionSection &&
+        aRole == Qt::DisplayRole)
+        v = VBoxImportApplianceWgt::tr ("Virtual System %1").arg (mNumber + 1);
+    return v;
+}
+
+void VirtualSystemItem::putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues)
+{
+    /* Resize the vectors */
+    unsigned long count = mDesc.GetCount();
+    aFinalStates.resize (count);
+    aFinalValues.resize (count);
+    aFinalExtraValues.resize (count);
+    /* Recursively fill the vectors */
+    ModelItem::putBack (aFinalStates, aFinalValues, aFinalExtraValues);
+    /* Set all final values at once */
+    mDesc.SetFinalValues (aFinalStates, aFinalValues, aFinalExtraValues);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// HardwareItem
+
+HardwareItem::HardwareItem (int aNumber,
+                            KVirtualSystemDescriptionType aType,
+                            const QString &aRef,
+                            const QString &aOrigValue,
+                            const QString &aConfigValue,
+                            const QString &aExtraConfigValue,
+                            ModelItem *aParent)
+  : ModelItem (aNumber, HardwareType, aParent)
+  , mType (aType)
+  , mRef (aRef)
+  , mOrigValue (aOrigValue)
+  , mConfigValue (aConfigValue)
+  , mConfigDefaultValue (aConfigValue)
+  , mExtraConfigValue (aExtraConfigValue)
+  , mCheckState (Qt::Checked)
+{}
+
+void HardwareItem::putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues)
+{
+    aFinalStates[mNumber] = mCheckState == Qt::Checked;
+    aFinalValues[mNumber] = mConfigValue;
+    aFinalExtraValues[mNumber] = mExtraConfigValue;
+    ModelItem::putBack (aFinalStates, aFinalValues, aFinalExtraValues);
+}
+
+bool HardwareItem::setData (int aColumn, const QVariant &aValue, int aRole)
+{
+    bool fDone = false;
+    switch (aRole)
+    {
+        case Qt::CheckStateRole:
+            {
+                if (aColumn == ConfigValueSection &&
+                    (mType == KVirtualSystemDescriptionType_Floppy ||
+                     mType == KVirtualSystemDescriptionType_CDROM ||
+                     mType == KVirtualSystemDescriptionType_USBController ||
+                     mType == KVirtualSystemDescriptionType_SoundCard ||
+                     mType == KVirtualSystemDescriptionType_NetworkAdapter))
+                {
+                    mCheckState = static_cast<Qt::CheckState> (aValue.toInt());
+                    fDone = true;
+                }
+                break;
+            }
+        default: break;
+    }
+    return fDone;
+}
+
+QVariant HardwareItem::data (int aColumn, int aRole) const
+{
+    QVariant v;
+    switch (aRole)
+    {
+        case Qt::DisplayRole:
+            {
+                if (aColumn == DescriptionSection)
+                {
+                    switch (mType)
+                    {
+                        case KVirtualSystemDescriptionType_Name: v = VBoxImportApplianceWgt::tr ("Name"); break;
+                        case KVirtualSystemDescriptionType_Product: v = VBoxImportApplianceWgt::tr ("Product"); break;
+                        case KVirtualSystemDescriptionType_ProductUrl: v = VBoxImportApplianceWgt::tr ("Product-URL"); break;
+                        case KVirtualSystemDescriptionType_Vendor: v = VBoxImportApplianceWgt::tr ("Vendor"); break;
+                        case KVirtualSystemDescriptionType_VendorUrl: v = VBoxImportApplianceWgt::tr ("Vendor-URL"); break;
+                        case KVirtualSystemDescriptionType_Version: v = VBoxImportApplianceWgt::tr ("Version"); break;
+                        case KVirtualSystemDescriptionType_Description: v = VBoxImportApplianceWgt::tr ("Description"); break;
+                        case KVirtualSystemDescriptionType_License: v = VBoxImportApplianceWgt::tr ("License"); break;
+                        case KVirtualSystemDescriptionType_OS: v = VBoxImportApplianceWgt::tr ("Guest OS Type"); break;
+                        case KVirtualSystemDescriptionType_CPU: v = VBoxImportApplianceWgt::tr ("CPU"); break;
+                        case KVirtualSystemDescriptionType_Memory: v = VBoxImportApplianceWgt::tr ("RAM"); break;
+                        case KVirtualSystemDescriptionType_HardDiskControllerIDE: v = VBoxImportApplianceWgt::tr ("Hard Disk Controller IDE"); break;
+                        case KVirtualSystemDescriptionType_HardDiskControllerSATA: v = VBoxImportApplianceWgt::tr ("Hard Disk Controller SATA"); break;
+                        case KVirtualSystemDescriptionType_HardDiskControllerSCSI: v = VBoxImportApplianceWgt::tr ("Hard Disk Controller SCSI"); break;
+                        case KVirtualSystemDescriptionType_CDROM: v = VBoxImportApplianceWgt::tr ("DVD"); break;
+                        case KVirtualSystemDescriptionType_Floppy: v = VBoxImportApplianceWgt::tr ("Floppy"); break;
+                        case KVirtualSystemDescriptionType_NetworkAdapter: v = VBoxImportApplianceWgt::tr ("Network Adapter"); break;
+                        case KVirtualSystemDescriptionType_USBController: v = VBoxImportApplianceWgt::tr ("USB Controller"); break;
+                        case KVirtualSystemDescriptionType_SoundCard: v = VBoxImportApplianceWgt::tr ("Sound Card"); break;
+                        case KVirtualSystemDescriptionType_HardDiskImage: v = VBoxImportApplianceWgt::tr ("Virtual Disk Image"); break;
+                        default: v = VBoxImportApplianceWgt::tr ("Unknown Hardware Item"); break;
+                    }
+                }
+                else if (aColumn == OriginalValueSection)
+                    v = mOrigValue;
+                else if (aColumn == ConfigValueSection)
+                {
+                    switch (mType)
+                    {
+                        case KVirtualSystemDescriptionType_Description:
+                        case KVirtualSystemDescriptionType_License:
+                            {
+                                /* Shorten the big text if there is more than
+                                 * one line */
+                                QString tmp (mConfigValue);
+                                tmp.replace (tmp.indexOf ('\n'), tmp.length(), "...");
+                                v = tmp; break;
+                            }
+                        case KVirtualSystemDescriptionType_OS: v = vboxGlobal().vmGuestOSTypeDescription (mConfigValue); break;
+                        case KVirtualSystemDescriptionType_Memory: v = mConfigValue + " " + VBoxImportApplianceWgt::tr ("MB"); break;
+                        case KVirtualSystemDescriptionType_SoundCard: v = vboxGlobal().toString (static_cast<KAudioControllerType> (mConfigValue.toInt())); break;
+                        case KVirtualSystemDescriptionType_NetworkAdapter: v = vboxGlobal().toString (static_cast<KNetworkAdapterType> (mConfigValue.toInt())); break;
+                        default: v = mConfigValue; break;
+                    }
+                }
+                break;
+            }
+        case Qt::ToolTipRole:
+            {
+                if (aColumn == ConfigValueSection)
+                {
+                    if (!mOrigValue.isEmpty())
+                        v = VBoxImportApplianceWgt::tr ("<b>Original Value:</b> %1").arg (mOrigValue);
+                }
+                break;
+            }
+        case Qt::DecorationRole:
+            {
+                if (aColumn == DescriptionSection)
+                {
+                    switch (mType)
+                    {
+                        case KVirtualSystemDescriptionType_Name: v = QIcon (":/name_16px.png"); break;
+                        case KVirtualSystemDescriptionType_Product:
+                        case KVirtualSystemDescriptionType_ProductUrl:
+                        case KVirtualSystemDescriptionType_Vendor:
+                        case KVirtualSystemDescriptionType_VendorUrl:
+                        case KVirtualSystemDescriptionType_Version:
+                        case KVirtualSystemDescriptionType_Description:
+                        case KVirtualSystemDescriptionType_License: v = QIcon (":/description_16px.png"); break;
+                        case KVirtualSystemDescriptionType_OS: v = QIcon (":/os_type_16px.png"); break;
+                        case KVirtualSystemDescriptionType_CPU: v = QIcon (":/cpu_16px.png"); break;
+                        case KVirtualSystemDescriptionType_Memory: v = QIcon (":/ram_16px.png"); break;
+                        case KVirtualSystemDescriptionType_HardDiskControllerIDE: v = QIcon (":/ide_16px.png"); break;
+                        case KVirtualSystemDescriptionType_HardDiskControllerSATA: v = QIcon (":/sata_16px.png"); break;
+                        case KVirtualSystemDescriptionType_HardDiskControllerSCSI: v = QIcon (":/scsi_16px.png"); break;
+                        case KVirtualSystemDescriptionType_HardDiskImage: v = QIcon (":/hd_16px.png"); break;
+                        case KVirtualSystemDescriptionType_CDROM: v = QIcon (":/cd_16px.png"); break;
+                        case KVirtualSystemDescriptionType_Floppy: v = QIcon (":/fd_16px.png"); break;
+                        case KVirtualSystemDescriptionType_NetworkAdapter: v = QIcon (":/nw_16px.png"); break;
+                        case KVirtualSystemDescriptionType_USBController: v = QIcon (":/usb_16px.png"); break;
+                        case KVirtualSystemDescriptionType_SoundCard: v = QIcon (":/sound_16px.png"); break;
+                        default: break;
+                    }
+                }
+                else if (aColumn == ConfigValueSection &&
+                         mType == KVirtualSystemDescriptionType_OS)
+                {
+                    v = vboxGlobal().vmGuestOSTypeIcon (mConfigValue).scaledToHeight (16, Qt::SmoothTransformation);
+                }
+                break;
+            }
+        case Qt::FontRole:
+            {
+                /* If the item is unchecked mark it with italic text. */
+                if (aColumn == ConfigValueSection &&
+                    mCheckState == Qt::Unchecked)
+                {
+                    QFont font = qApp->font();
+                    font.setItalic (true);
+                    v = font;
+                }
+                break;
+            }
+        case Qt::ForegroundRole:
+            {
+                /* If the item is unchecked mark it with gray text. */
+                if (aColumn == ConfigValueSection &&
+                    mCheckState == Qt::Unchecked)
+                {
+                    QPalette pal = qApp->palette();
+                    v = pal.brush (QPalette::Disabled, QPalette::WindowText);
+                }
+                break;
+            }
+        case Qt::CheckStateRole:
+            {
+                if (aColumn == ConfigValueSection &&
+                    (mType == KVirtualSystemDescriptionType_Floppy ||
+                     mType == KVirtualSystemDescriptionType_CDROM ||
+                     mType == KVirtualSystemDescriptionType_USBController ||
+                     mType == KVirtualSystemDescriptionType_SoundCard ||
+                     mType == KVirtualSystemDescriptionType_NetworkAdapter))
+                    v = mCheckState;
+                break;
+            }
+    }
+    return v;
+}
+
+Qt::ItemFlags HardwareItem::itemFlags (int aColumn) const
+{
+    Qt::ItemFlags flags = 0;
+    if (aColumn == ConfigValueSection)
+    {
+        /* Some items are checkable */
+        if (mType == KVirtualSystemDescriptionType_Floppy ||
+            mType == KVirtualSystemDescriptionType_CDROM ||
+            mType == KVirtualSystemDescriptionType_USBController ||
+            mType == KVirtualSystemDescriptionType_SoundCard ||
+            mType == KVirtualSystemDescriptionType_NetworkAdapter)
+            flags |= Qt::ItemIsUserCheckable;
+        /* Some items are editable */
+        if ((mType == KVirtualSystemDescriptionType_Name ||
+             mType == KVirtualSystemDescriptionType_Product ||
+             mType == KVirtualSystemDescriptionType_ProductUrl ||
+             mType == KVirtualSystemDescriptionType_Vendor ||
+             mType == KVirtualSystemDescriptionType_VendorUrl ||
+             mType == KVirtualSystemDescriptionType_Version ||
+             mType == KVirtualSystemDescriptionType_Description ||
+             mType == KVirtualSystemDescriptionType_License ||
+             mType == KVirtualSystemDescriptionType_OS ||
+             mType == KVirtualSystemDescriptionType_Memory ||
+             mType == KVirtualSystemDescriptionType_SoundCard ||
+             mType == KVirtualSystemDescriptionType_NetworkAdapter ||
+             mType == KVirtualSystemDescriptionType_HardDiskControllerIDE ||
+             mType == KVirtualSystemDescriptionType_HardDiskImage) &&
+            mCheckState == Qt::Checked) /* Item has to be enabled */
+            flags |= Qt::ItemIsEditable;
+    }
+    return flags;
+}
+
+QWidget * HardwareItem::createEditor (QWidget *aParent, const QStyleOptionViewItem & /* aOption */, const QModelIndex &aIndex) const
+{
+    QWidget *editor = NULL;
+    if (aIndex.column() == ConfigValueSection)
+    {
+        switch (mType)
+        {
+            case KVirtualSystemDescriptionType_OS:
+                {
+                    VBoxOSTypeSelectorButton *e = new VBoxOSTypeSelectorButton (aParent);
+                    /* Fill the background with the highlight color in the case
+                     * the button hasn't a rectangle shape. This prevents the
+                     * display of parts from the current text on the Mac. */
+                    e->setAutoFillBackground (true);
+                    e->setBackgroundRole (QPalette::Highlight);
+                    editor = e;
+                    break;
+                }
+            case KVirtualSystemDescriptionType_Name:
+            case KVirtualSystemDescriptionType_Product:
+            case KVirtualSystemDescriptionType_ProductUrl:
+            case KVirtualSystemDescriptionType_Vendor:
+            case KVirtualSystemDescriptionType_VendorUrl:
+            case KVirtualSystemDescriptionType_Version:
+                {
+                    QLineEdit *e = new QLineEdit (aParent);
+                    editor = e;
+                    break;
+                }
+            case KVirtualSystemDescriptionType_Description:
+            case KVirtualSystemDescriptionType_License:
+                {
+                    VBoxLineTextEdit *e = new VBoxLineTextEdit (aParent);
+                    editor = e;
+                    break;
+                }
+            case KVirtualSystemDescriptionType_CPU:
+                {
+                    QSpinBox *e = new QSpinBox (aParent);
+                    e->setRange (VBoxImportApplianceWgt::minGuestCPUCount(), VBoxImportApplianceWgt::maxGuestCPUCount());
+                    editor = e;
+                    break;
+                }
+            case KVirtualSystemDescriptionType_Memory:
+                {
+                    QSpinBox *e = new QSpinBox (aParent);
+                    e->setRange (VBoxImportApplianceWgt::minGuestRAM(), VBoxImportApplianceWgt::maxGuestRAM());
+                    e->setSuffix (" " + VBoxImportApplianceWgt::tr ("MB"));
+                    editor = e;
+                    break;
+                }
+            case KVirtualSystemDescriptionType_SoundCard:
+                {
+                    QComboBox *e = new QComboBox (aParent);
+                    e->addItem (vboxGlobal().toString (KAudioControllerType_AC97), KAudioControllerType_AC97);
+                    e->addItem (vboxGlobal().toString (KAudioControllerType_SB16), KAudioControllerType_SB16);
+                    editor = e;
+                    break;
+                }
+            case KVirtualSystemDescriptionType_NetworkAdapter:
+                {
+                    QComboBox *e = new QComboBox (aParent);
+                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_Am79C970A), KNetworkAdapterType_Am79C970A);
+                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_Am79C973), KNetworkAdapterType_Am79C973);
+#ifdef VBOX_WITH_E1000
+                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_I82540EM), KNetworkAdapterType_I82540EM);
+                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_I82543GC), KNetworkAdapterType_I82543GC);
+#endif /* VBOX_WITH_E1000 */
+                    editor = e;
+                    break;
+                }
+            case KVirtualSystemDescriptionType_HardDiskControllerIDE:
+                {
+                    QComboBox *e = new QComboBox (aParent);
+                    e->addItem (vboxGlobal().toString (KStorageControllerType_PIIX3), "PIIX3");
+                    e->addItem (vboxGlobal().toString (KStorageControllerType_PIIX4), "PIIX4");
+                    e->addItem (vboxGlobal().toString (KStorageControllerType_ICH6),  "ICH6");
+                    editor = e;
+                    break;
+                }
+            case KVirtualSystemDescriptionType_HardDiskImage:
+                {
+                    /* disabled for now
+                       VBoxFilePathSelectorWidget *e = new VBoxFilePathSelectorWidget (aParent);
+                       e->setMode (VBoxFilePathSelectorWidget::Mode_File);
+                       e->setResetEnabled (false);
+                       */
+                    QLineEdit *e = new QLineEdit (aParent);
+                    editor = e;
+                    break;
+                }
+            default: break;
+        }
+    }
+    return editor;
+}
+
+bool HardwareItem::setEditorData (QWidget *aEditor, const QModelIndex & /* aIndex */) const
+{
+    bool fDone = false;
+    switch (mType)
+    {
+        case KVirtualSystemDescriptionType_OS:
+            {
+                if (VBoxOSTypeSelectorButton *e = qobject_cast<VBoxOSTypeSelectorButton*> (aEditor))
+                {
+                    e->setOSTypeId (mConfigValue);
+                    fDone = true;
+                }
+                break;
+            }
+        case KVirtualSystemDescriptionType_HardDiskControllerIDE:
+            {
+                if (QComboBox *e = qobject_cast<QComboBox*> (aEditor))
+                {
+                    int i = e->findData (mConfigValue);
+                    if (i != -1)
+                        e->setCurrentIndex (i);
+                    fDone = true;
+                }
+                break;
+            }
+        case KVirtualSystemDescriptionType_CPU:
+        case KVirtualSystemDescriptionType_Memory:
+            {
+                if (QSpinBox *e = qobject_cast<QSpinBox*> (aEditor))
+                {
+                    e->setValue (mConfigValue.toInt());
+                    fDone = true;
+                }
+                break;
+            }
+        case KVirtualSystemDescriptionType_Name:
+        case KVirtualSystemDescriptionType_Product:
+        case KVirtualSystemDescriptionType_ProductUrl:
+        case KVirtualSystemDescriptionType_Vendor:
+        case KVirtualSystemDescriptionType_VendorUrl:
+        case KVirtualSystemDescriptionType_Version:
+            {
+                if (QLineEdit *e = qobject_cast<QLineEdit*> (aEditor))
+                {
+                    e->setText (mConfigValue);
+                    fDone = true;
+                }
+                break;
+            }
+        case KVirtualSystemDescriptionType_Description:
+        case KVirtualSystemDescriptionType_License:
+            {
+                if (VBoxLineTextEdit *e = qobject_cast<VBoxLineTextEdit*> (aEditor))
+                {
+                    e->setText (mConfigValue);
+                    fDone = true;
+                }
+                break;
+            }
+        case KVirtualSystemDescriptionType_SoundCard:
+        case KVirtualSystemDescriptionType_NetworkAdapter:
+            {
+                if (QComboBox *e = qobject_cast<QComboBox*> (aEditor))
+                {
+                    int i = e->findData (mConfigValue.toInt());
+                    if (i != -1)
+                        e->setCurrentIndex (i);
+                    fDone = true;
+                }
+                break;
+            }
+        case KVirtualSystemDescriptionType_HardDiskImage:
+            {
+                /* disabled for now
+                   if (VBoxFilePathSelectorWidget *e = qobject_cast<VBoxFilePathSelectorWidget*> (aEditor))
+                   {
+                   e->setPath (mConfigValue);
+                   }
+                   */
+                if (QLineEdit *e = qobject_cast<QLineEdit*> (aEditor))
+                {
+                    e->setText (mConfigValue);
+                    fDone = true;
+                }
+                break;
+            }
+        default: break;
+    }
+    return fDone;
+}
+
+bool HardwareItem::setModelData (QWidget *aEditor, QAbstractItemModel * /* aModel */, const QModelIndex & /* aIndex */)
+{
+    bool fDone = false;
+    switch (mType)
+    {
+        case KVirtualSystemDescriptionType_OS:
+            {
+                if (VBoxOSTypeSelectorButton *e = qobject_cast<VBoxOSTypeSelectorButton*> (aEditor))
+                {
+                    mConfigValue = e->osTypeId();
+                    fDone = true;
+                }
+                break;
+            }
+        case KVirtualSystemDescriptionType_HardDiskControllerIDE:
+            {
+                if (QComboBox *e = qobject_cast<QComboBox*> (aEditor))
+                {
+                    mConfigValue = e->itemData (e->currentIndex()).toString();
+                    fDone = true;
+                }
+                break;
+            }
+        case KVirtualSystemDescriptionType_CPU:
+        case KVirtualSystemDescriptionType_Memory:
+            {
+                if (QSpinBox *e = qobject_cast<QSpinBox*> (aEditor))
+                {
+                    mConfigValue = QString::number (e->value());
+                    fDone = true;
+                }
+                break;
+            }
+        case KVirtualSystemDescriptionType_Name:
+        case KVirtualSystemDescriptionType_Product:
+        case KVirtualSystemDescriptionType_ProductUrl:
+        case KVirtualSystemDescriptionType_Vendor:
+        case KVirtualSystemDescriptionType_VendorUrl:
+        case KVirtualSystemDescriptionType_Version:
+            {
+                if (QLineEdit *e = qobject_cast<QLineEdit*> (aEditor))
+                {
+                    mConfigValue = e->text();
+                    fDone = true;
+                }
+                break;
+            }
+        case KVirtualSystemDescriptionType_Description:
+        case KVirtualSystemDescriptionType_License:
+            {
+                if (VBoxLineTextEdit *e = qobject_cast<VBoxLineTextEdit*> (aEditor))
+                {
+                    mConfigValue = e->text();
+                    fDone = true;
+                }
+                break;
+            }
+        case KVirtualSystemDescriptionType_SoundCard:
+        case KVirtualSystemDescriptionType_NetworkAdapter:
+            {
+                if (QComboBox *e = qobject_cast<QComboBox*> (aEditor))
+                {
+                    mConfigValue = e->itemData (e->currentIndex()).toString();
+                    fDone = true;
+                }
+                break;
+            }
+        case KVirtualSystemDescriptionType_HardDiskImage:
+            {
+                /* disabled for now
+                   if (VBoxFilePathSelectorWidget *e = qobject_cast<VBoxFilePathSelectorWidget*> (aEditor))
+                   {
+                   mConfigValue = e->path();
+                   }
+                   */
+                if (QLineEdit *e = qobject_cast<QLineEdit*> (aEditor))
+                {
+                    mConfigValue = e->text();
+                    fDone = true;
+                }
+                break;
+            }
+        default: break;
+    }
+    return fDone;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// VirtualSystemModel
+
+/* This class is a wrapper model for our ModelItem. It could be used with any
+   TreeView & forward mostly all calls to the methods of ModelItem. The
+   ModelItems itself are stored as internal pointers in the QModelIndex class. */
+VirtualSystemModel::VirtualSystemModel (QVector<CVirtualSystemDescription>& aVSDs, QObject *aParent /* = NULL */)
+   : QAbstractItemModel (aParent)
+{
+    mRootItem = new ModelItem (0, RootType);
+    for (int a = 0; a < aVSDs.size(); ++a)
+    {
+        CVirtualSystemDescription vs = aVSDs[a];
+
+        VirtualSystemItem *vi = new VirtualSystemItem (a, vs, mRootItem);
+        mRootItem->appendChild (vi);
+
+        /* @todo: ask Dmitry about include/COMDefs.h:232 */
+        QVector<KVirtualSystemDescriptionType> types;
+        QVector<QString> refs;
+        QVector<QString> origValues;
+        QVector<QString> configValues;
+        QVector<QString> extraConfigValues;
+
+        QList<int> hdIndizies;
+        QMap<int, HardwareItem*> controllerMap;
+        vs.GetDescription (types, refs, origValues, configValues, extraConfigValues);
+        for (int i = 0; i < types.size(); ++i)
+        {
+            /* We add the hard disk images in an second step, so save a
+               reference to them. */
+            if (types[i] == KVirtualSystemDescriptionType_HardDiskImage)
+                hdIndizies << i;
+            else
+            {
+                HardwareItem *hi = new HardwareItem (i, types[i], refs[i], origValues[i], configValues[i], extraConfigValues[i], vi);
+                vi->appendChild (hi);
+                /* Save the hard disk controller types in an extra map */
+                if (types[i] == KVirtualSystemDescriptionType_HardDiskControllerIDE ||
+                    types[i] == KVirtualSystemDescriptionType_HardDiskControllerSATA ||
+                    types[i] == KVirtualSystemDescriptionType_HardDiskControllerSCSI)
+                    controllerMap[i] = hi;
+            }
+        }
+        QRegExp rx ("controller=(\\d+);?");
+        /* Now process the hard disk images */
+        for (int a = 0; a < hdIndizies.size(); ++a)
+        {
+            int i = hdIndizies[a];
+            QString ecnf = extraConfigValues[i];
+            if (rx.indexIn (ecnf) != -1)
+            {
+                /* Get the controller */
+                HardwareItem *ci = controllerMap[rx.cap (1).toInt()];
+                if (ci)
+                {
+                    /* New hardware item as child of the controller */
+                    HardwareItem *hi = new HardwareItem (i, types[i], refs[i], origValues[i], configValues[i], extraConfigValues[i], ci);
+                    ci->appendChild (hi);
+                }
+            }
+        }
+    }
+}
+
+QModelIndex VirtualSystemModel::index (int aRow, int aColumn, const QModelIndex &aParent /* = QModelIndex() */) const
+{
+    if (!hasIndex (aRow, aColumn, aParent))
+        return QModelIndex();
+
+    ModelItem *parentItem;
+
+    if (!aParent.isValid())
+        parentItem = mRootItem;
+    else
+        parentItem = static_cast<ModelItem*> (aParent.internalPointer());
+
+    ModelItem *childItem = parentItem->child (aRow);
+    if (childItem)
+        return createIndex (aRow, aColumn, childItem);
+    else
+        return QModelIndex();
+}
+
+QModelIndex VirtualSystemModel::parent (const QModelIndex &aIndex) const
+{
+    if (!aIndex.isValid())
+        return QModelIndex();
+
+    ModelItem *childItem = static_cast<ModelItem*> (aIndex.internalPointer());
+    ModelItem *parentItem = childItem->parent();
+
+    if (parentItem == mRootItem)
+        return QModelIndex();
+
+    return createIndex (parentItem->row(), 0, parentItem);
+}
+
+int VirtualSystemModel::rowCount (const QModelIndex &aParent /* = QModelIndex() */) const
+{
+    ModelItem *parentItem;
+    if (aParent.column() > 0)
+        return 0;
+
+    if (!aParent.isValid())
+        parentItem = mRootItem;
+    else
+        parentItem = static_cast<ModelItem*> (aParent.internalPointer());
+
+    return parentItem->childCount();
+}
+
+int VirtualSystemModel::columnCount (const QModelIndex &aParent /* = QModelIndex() */) const
+{
+    if (aParent.isValid())
+        return static_cast<ModelItem*> (aParent.internalPointer())->columnCount();
+    else
+        return mRootItem->columnCount();
+}
+
+bool VirtualSystemModel::setData (const QModelIndex &aIndex, const QVariant &aValue, int aRole)
+{
+    if (!aIndex.isValid())
+        return false;
+
+    ModelItem *item = static_cast<ModelItem*> (aIndex.internalPointer());
+
+    return item->setData (aIndex.column(), aValue, aRole);
+}
+
+QVariant VirtualSystemModel::data (const QModelIndex &aIndex, int aRole /* = Qt::DisplayRole */) const
+{
+    if (!aIndex.isValid())
+        return QVariant();
+
+    ModelItem *item = static_cast<ModelItem*> (aIndex.internalPointer());
+
+    return item->data (aIndex.column(), aRole);
+}
+
+Qt::ItemFlags VirtualSystemModel::flags (const QModelIndex &aIndex) const
+{
+    if (!aIndex.isValid())
+        return 0;
+
+    ModelItem *item = static_cast<ModelItem*> (aIndex.internalPointer());
+
+    return Qt::ItemIsEnabled | Qt::ItemIsSelectable | item->itemFlags (aIndex.column());
+}
+
+QVariant VirtualSystemModel::headerData (int aSection, Qt::Orientation aOrientation, int aRole) const
+{
+    if (aRole != Qt::DisplayRole ||
+        aOrientation != Qt::Horizontal)
+        return QVariant();
+
+    QString title;
+    switch (aSection)
+    {
+        case DescriptionSection: title = VBoxImportApplianceWgt::tr ("Description"); break;
+        case ConfigValueSection: title = VBoxImportApplianceWgt::tr ("Configuration"); break;
+    }
+    return title;
+}
+
+void VirtualSystemModel::restoreDefaults (const QModelIndex& aParent /* = QModelIndex() */)
+{
+    ModelItem *parentItem;
+
+    if (!aParent.isValid())
+        parentItem = mRootItem;
+    else
+        parentItem = static_cast<ModelItem*> (aParent.internalPointer());
+
+    for (int i = 0; i < parentItem->childCount(); ++i)
+    {
+        parentItem->child (i)->restoreDefaults();
+        restoreDefaults (index (i, 0, aParent));
+    }
+    emit dataChanged (index (0, 0, aParent), index (parentItem->childCount()-1, 0, aParent));
+}
+
+void VirtualSystemModel::putBack()
+{
+    QVector<BOOL> v1;
+    QVector<QString> v2;
+    QVector<QString> v3;
+    mRootItem->putBack (v1, v2, v3);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// VirtualSystemDelegate
+
+/* The delegate is used for creating/handling the different editors for the
+   various types we support. This class forward the requests to the virtual
+   methods of our different ModelItems. If this is not possible the default
+   methods of QItemDelegate are used to get some standard behavior. Note: We
+   have to handle the proxy model ourself. I really don't understand why Qt is
+   not doing this for us. */
+VirtualSystemDelegate::VirtualSystemDelegate (QAbstractProxyModel *aProxy, QObject *aParent /* = NULL */)
+  : QItemDelegate (aParent)
+  , mProxy (aProxy)
+{}
+
+QWidget * VirtualSystemDelegate::createEditor (QWidget *aParent, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const
+{
+    if (!aIndex.isValid())
+        return QItemDelegate::createEditor (aParent, aOption, aIndex);
+
+    QModelIndex index (aIndex);
+    if (mProxy)
+        index = mProxy->mapToSource (aIndex);
+
+    ModelItem *item = static_cast<ModelItem*> (index.internalPointer());
+    QWidget *editor = item->createEditor (aParent, aOption, index);
+
+    if (editor == NULL)
+        return QItemDelegate::createEditor (aParent, aOption, index);
+    else
+        return editor;
+}
+
+void VirtualSystemDelegate::setEditorData (QWidget *aEditor, const QModelIndex &aIndex) const
+{
+    if (!aIndex.isValid())
+        return QItemDelegate::setEditorData (aEditor, aIndex);
+
+    QModelIndex index (aIndex);
+    if (mProxy)
+        index = mProxy->mapToSource (aIndex);
+
+    ModelItem *item = static_cast<ModelItem*> (index.internalPointer());
+
+    if (!item->setEditorData (aEditor, index))
+        QItemDelegate::setEditorData (aEditor, index);
+}
+
+void VirtualSystemDelegate::setModelData (QWidget *aEditor, QAbstractItemModel *aModel, const QModelIndex &aIndex) const
+{
+    if (!aIndex.isValid())
+        return QItemDelegate::setModelData (aEditor, aModel, aIndex);
+
+    QModelIndex index = aModel->index (aIndex.row(), aIndex.column());
+    if (mProxy)
+        index = mProxy->mapToSource (aIndex);
+
+    ModelItem *item = static_cast<ModelItem*> (index.internalPointer());
+    if (!item->setModelData (aEditor, aModel, index))
+        QItemDelegate::setModelData (aEditor, aModel, aIndex);
+}
+
+void VirtualSystemDelegate::updateEditorGeometry (QWidget *aEditor, const QStyleOptionViewItem &aOption, const QModelIndex & /* aIndex */) const
+{
+    if (aEditor)
+        aEditor->setGeometry (aOption.rect);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// VirtualSystemSortProxyModel
+
+/* How to sort the items in the tree view */
+KVirtualSystemDescriptionType VirtualSystemSortProxyModel::mSortList[] =
+{
+    KVirtualSystemDescriptionType_Name,
+    KVirtualSystemDescriptionType_Product,
+    KVirtualSystemDescriptionType_ProductUrl,
+    KVirtualSystemDescriptionType_Vendor,
+    KVirtualSystemDescriptionType_VendorUrl,
+    KVirtualSystemDescriptionType_Version,
+    KVirtualSystemDescriptionType_Description,
+    KVirtualSystemDescriptionType_License,
+    KVirtualSystemDescriptionType_OS,
+    KVirtualSystemDescriptionType_CPU,
+    KVirtualSystemDescriptionType_Memory,
+    KVirtualSystemDescriptionType_Floppy,
+    KVirtualSystemDescriptionType_CDROM,
+    KVirtualSystemDescriptionType_USBController,
+    KVirtualSystemDescriptionType_SoundCard,
+    KVirtualSystemDescriptionType_NetworkAdapter,
+    KVirtualSystemDescriptionType_HardDiskControllerIDE,
+    KVirtualSystemDescriptionType_HardDiskControllerSATA,
+    KVirtualSystemDescriptionType_HardDiskControllerSCSI
+};
+
+VirtualSystemSortProxyModel::VirtualSystemSortProxyModel (QObject *aParent)
+    : QSortFilterProxyModel (aParent)
+{}
+
+bool VirtualSystemSortProxyModel::filterAcceptsRow (int aSourceRow, const QModelIndex & aSourceParent) const
+{
+    /* By default enable all, we will explicitly filter out below */
+    if (aSourceParent.isValid())
+    {
+        QModelIndex i = aSourceParent.child (aSourceRow, 0);
+        if (i.isValid())
+        {
+            ModelItem *item = static_cast<ModelItem*> (i.internalPointer());
+            /* We filter hardware types only */
+            if (item->type() == HardwareType)
+            {
+                HardwareItem *hwItem = static_cast<HardwareItem*> (item);
+                /* The license type shouldn't be displayed */
+                if (mFilterList.contains (hwItem->mType))
+                    return false;
+            }
+        }
+    }
+    return true;
+}
+
+bool VirtualSystemSortProxyModel::lessThan (const QModelIndex &aLeft, const QModelIndex &aRight) const
+{
+    if (!aLeft.isValid() ||
+        !aRight.isValid())
+        return false;
+
+    ModelItem *leftItem = static_cast<ModelItem*> (aLeft.internalPointer());
+    ModelItem *rightItem = static_cast<ModelItem*> (aRight.internalPointer());
+
+    /* We sort hardware types only */
+    if (!(leftItem->type() == HardwareType &&
+          rightItem->type() == HardwareType))
+        return false;
+
+    HardwareItem *hwLeft = static_cast<HardwareItem*> (leftItem);
+    HardwareItem *hwRight = static_cast<HardwareItem*> (rightItem);
+
+    for (unsigned int i = 0; i < RT_ELEMENTS (mSortList); ++i)
+        if (hwLeft->mType == mSortList[i])
+        {
+            for (unsigned int a = 0; a <= i; ++a)
+                if (hwRight->mType == mSortList[a])
+                    return true;
+            return false;
+        }
+
+    return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// VBoxApplianceEditorWgt
+
+VBoxApplianceEditorWgt::VBoxApplianceEditorWgt (QWidget *aParent /* = NULL */)
+    : QIWithRetranslateUI<QWidget> (aParent)
+    , mAppliance (NULL)
+    , mModel (NULL)
+{
+    /* Apply UI decorations */
+    Ui::VBoxApplianceEditorWgt::setupUi (this);
+
+    /* Make the tree looking nicer */
+    mTvSettings->setRootIsDecorated (false);
+    mTvSettings->setAlternatingRowColors (true);
+    mTvSettings->header()->setStretchLastSection (true);
+    mTvSettings->header()->setResizeMode (QHeaderView::ResizeToContents);
+
+    /* Applying language settings */
+    retranslateUi();
+}
+
+void VBoxApplianceEditorWgt::restoreDefaults()
+{
+    mModel->restoreDefaults();
+}
+
+void VBoxApplianceEditorWgt::retranslateUi()
+{
+    /* Translate uic generated strings */
+    Ui::VBoxApplianceEditorWgt::retranslateUi (this);
+}
+
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxExportApplianceWgt.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxExportApplianceWgt.cpp	(revision 18378)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxExportApplianceWgt.cpp	(revision 18378)
@@ -0,0 +1,111 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxExportApplianceWgt class implementation
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+/* VBox includes */
+#include "VBoxExportApplianceWgt.h"
+#include "VBoxGlobal.h"
+#include "VBoxProblemReporter.h"
+
+////////////////////////////////////////////////////////////////////////////////
+// ExportSortProxyModel
+
+class ExportSortProxyModel: public VirtualSystemSortProxyModel
+{
+public:
+    ExportSortProxyModel (QObject *aParent = NULL)
+      : VirtualSystemSortProxyModel (aParent)
+    {
+        mFilterList
+            << KVirtualSystemDescriptionType_OS
+            << KVirtualSystemDescriptionType_CPU
+            << KVirtualSystemDescriptionType_Memory
+            << KVirtualSystemDescriptionType_Floppy
+            << KVirtualSystemDescriptionType_CDROM
+            << KVirtualSystemDescriptionType_USBController
+            << KVirtualSystemDescriptionType_SoundCard
+            << KVirtualSystemDescriptionType_NetworkAdapter
+            << KVirtualSystemDescriptionType_HardDiskControllerIDE
+            << KVirtualSystemDescriptionType_HardDiskControllerSATA
+            << KVirtualSystemDescriptionType_HardDiskControllerSCSI;
+    }
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// VBoxExportApplianceWgt
+
+VBoxExportApplianceWgt::VBoxExportApplianceWgt (QWidget *aParent /* = NULL */)
+  : VBoxApplianceEditorWgt (aParent)
+{
+}
+
+CAppliance* VBoxExportApplianceWgt::init()
+{
+    if (mAppliance)
+        delete mAppliance;
+    CVirtualBox vbox = vboxGlobal().virtualBox();
+    /* Create a appliance object */
+    mAppliance = new CAppliance(vbox.CreateAppliance());
+//    bool fResult = mAppliance->isOk();
+    return mAppliance;
+}
+
+void VBoxExportApplianceWgt::populate()
+{
+    if (mModel)
+        delete mModel;
+
+    QVector<CVirtualSystemDescription> vsds = mAppliance->GetVirtualSystemDescriptions();
+
+    mModel = new VirtualSystemModel (vsds, this);
+
+    ExportSortProxyModel *proxy = new ExportSortProxyModel (this);
+    proxy->setSourceModel (mModel);
+    proxy->sort (DescriptionSection, Qt::DescendingOrder);
+
+    VirtualSystemDelegate *delegate = new VirtualSystemDelegate (proxy, this);
+
+    /* Set our own model */
+    mTvSettings->setModel (proxy);
+    /* Set our own delegate */
+    mTvSettings->setItemDelegate (delegate);
+    /* For now we hide the original column. This data is displayed as tooltip
+       also. */
+    mTvSettings->setColumnHidden (OriginalValueSection, true);
+    mTvSettings->expandAll();
+
+    /* Check for warnings & if there are one display them. */
+    bool fWarningsEnabled = false;
+    QVector<QString> warnings = mAppliance->GetWarnings();
+    if (warnings.size() > 0)
+    {
+        foreach (const QString& text, warnings)
+            mWarningTextEdit->append ("- " + text);
+        fWarningsEnabled = true;
+    }
+    mWarningWidget->setShown (fWarningsEnabled);
+}
+
+void VBoxExportApplianceWgt::prepareExport()
+{
+    if (mAppliance)
+        mModel->putBack();
+}
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxExportApplianceWzd.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxExportApplianceWzd.cpp	(revision 18377)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxExportApplianceWzd.cpp	(revision 18378)
@@ -82,4 +82,8 @@
 #endif /* Q_WS_MAC */
 
+    /* Connect the restore button with the settings widget */
+    connect (mBtnRestore, SIGNAL (clicked()),
+             mExportSettingsWgt, SLOT (restoreDefaults()));
+
     /* Validator for the file selector page */
     mWValFileSelector = new QIWidgetValidator (mFileSelectPage, this);
@@ -131,33 +135,29 @@
 void VBoxExportApplianceWzd::accept()
 {
-    CAppliance appliance;
-    /* Prepare the export of the VM's. */
-    if (prepareForExportVMs (appliance))
-    {
-        QFileInfo fi (mFileSelector->path());
-        QStringList files;
-        files << mFileSelector->path();
-        /* We need to know every filename which will be created, so that we can
-         * ask the user for confirmation of overwriting. For that we iterating
-         * over all virtual systems & fetch all descriptions of the type
-         * HardDiskImage. */
-        CVirtualSystemDescriptionVector vsds = appliance.GetVirtualSystemDescriptions();
-        for (int i=0; i < vsds.size(); ++i)
-        {
-            QVector<KVirtualSystemDescriptionType> types;
-            QVector<QString> refs, origValues, configValues, extraConfigValues;
-
-            vsds[i].GetDescriptionByType (KVirtualSystemDescriptionType_HardDiskImage, types, refs, origValues, configValues, extraConfigValues);
-            foreach (const QString &s, origValues)
-                files << QString ("%1/%2").arg (fi.absolutePath()).arg (s);
-        }
-        /* Check if the file exists already, if yes get confirmation for
-         * overwriting from the user. */
-        if (!vboxProblem().askForOverridingFilesIfExists (files, this))
-            return;
-        /* Export the VMs, on success we are finished */
-        if (exportVMs(appliance))
-            QIAbstractWizard::accept();
-    }
+    CAppliance *appliance = mExportSettingsWgt->appliance();
+    QFileInfo fi (mFileSelector->path());
+    QStringList files;
+    files << mFileSelector->path();
+    /* We need to know every filename which will be created, so that we can
+     * ask the user for confirmation of overwriting. For that we iterating
+     * over all virtual systems & fetch all descriptions of the type
+     * HardDiskImage. */
+    CVirtualSystemDescriptionVector vsds = appliance->GetVirtualSystemDescriptions();
+    for (int i=0; i < vsds.size(); ++i)
+    {
+        QVector<KVirtualSystemDescriptionType> types;
+        QVector<QString> refs, origValues, configValues, extraConfigValues;
+
+        vsds[i].GetDescriptionByType (KVirtualSystemDescriptionType_HardDiskImage, types, refs, origValues, configValues, extraConfigValues);
+        foreach (const QString &s, origValues)
+            files << QString ("%1/%2").arg (fi.absolutePath()).arg (s);
+    }
+    /* Check if the file exists already, if yes get confirmation for
+     * overwriting from the user. */
+    if (!vboxProblem().askForOverridingFilesIfExists (files, this))
+        return;
+    /* Export the VMs, on success we are finished */
+    if (exportVMs(*appliance))
+        QIAbstractWizard::accept();
 }
 
@@ -166,4 +166,9 @@
     /* We propose a filename the first time the second page is displayed */
     if (sender() == mBtnNext1)
+    {
+        prepareSettingsWidget();
+    }
+    else if (sender() == mBtnNext2)
+    {
         if (mFileSelector->path().isEmpty())
         {
@@ -178,4 +183,6 @@
             mWValFileSelector->revalidate();
         }
+        mExportSettingsWgt->prepareExport();
+    }
 
     QIAbstractWizard::showNextPage();
@@ -236,10 +243,9 @@
 }
 
-bool VBoxExportApplianceWzd::prepareForExportVMs (CAppliance &aAppliance)
+bool VBoxExportApplianceWzd::prepareSettingsWidget()
 {
     CVirtualBox vbox = vboxGlobal().virtualBox();
-    /* Create a appliance object */
-    aAppliance = vbox.CreateAppliance();
-    bool fResult = aAppliance.isOk();
+    CAppliance *appliance = mExportSettingsWgt->init();
+    bool fResult = appliance->isOk();
     if (fResult)
     {
@@ -256,18 +262,27 @@
             {
                 /* Add the export description to our appliance object */
-                CVirtualSystemDescription vsd = m.Export (aAppliance);
+                CVirtualSystemDescription vsd = m.Export (*appliance);
                 fResult = m.isOk();
                 if (!fResult)
                 {
-                    vboxProblem().cannotExportAppliance (m, &aAppliance, this);
+                    vboxProblem().cannotExportAppliance (m, appliance, this);
                     return false;
                 }
+                /* Now add some new fields the user may change */
+                vsd.AddDescription (KVirtualSystemDescriptionType_Product, "", "");
+                vsd.AddDescription (KVirtualSystemDescriptionType_ProductUrl, "", "");
+                vsd.AddDescription (KVirtualSystemDescriptionType_Vendor, "", "");
+                vsd.AddDescription (KVirtualSystemDescriptionType_VendorUrl, "", "");
+                vsd.AddDescription (KVirtualSystemDescriptionType_Version, "", "");
+                vsd.AddDescription (KVirtualSystemDescriptionType_License, "", "");
             }
             else
                 break;
         }
+        /* Make sure the settings widget get the new descriptions */
+        mExportSettingsWgt->populate();
     }
     if (!fResult)
-        vboxProblem().cannotExportAppliance (&aAppliance, this);
+        vboxProblem().cannotExportAppliance (appliance, this);
     return fResult;
 }
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxImportApplianceWgt.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxImportApplianceWgt.cpp	(revision 18377)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxImportApplianceWgt.cpp	(revision 18378)
@@ -21,995 +21,21 @@
  */
 
+/* VBox includes */
 #include "VBoxImportApplianceWgt.h"
-#include "VBoxImportApplianceWzd.h"
 #include "VBoxGlobal.h"
 #include "VBoxProblemReporter.h"
-#include "VBoxFilePathSelectorWidget.h"
-#include "VBoxOSTypeSelectorButton.h"
-
-/* Qt includes */
-#include <QItemDelegate>
-#include <QSortFilterProxyModel>
-#include <QHeaderView>
-#include <QLineEdit>
-#include <QTextEdit>
-#include <QSpinBox>
-#include <QComboBox>
-
-class ModelItem;
 
 ////////////////////////////////////////////////////////////////////////////////
-// Globals
+// ImportSortProxyModel
 
-enum TreeViewSection { DescriptionSection = 0, OriginalValueSection, ConfigValueSection };
-
-////////////////////////////////////////////////////////////////////////////////
-// Private helper class declarations
-
-class VirtualSystemSortProxyModel: public QSortFilterProxyModel
+class ImportSortProxyModel: public VirtualSystemSortProxyModel
 {
 public:
-    VirtualSystemSortProxyModel (QObject *aParent = NULL);
-
-protected:
-    bool filterAcceptsRow (int aSourceRow, const QModelIndex & aSourceParent) const;
-    bool lessThan (const QModelIndex &aLeft, const QModelIndex &aRight) const;
-
-    static KVirtualSystemDescriptionType mSortList[];
+    ImportSortProxyModel (QObject *aParent = NULL)
+      : VirtualSystemSortProxyModel (aParent)
+    {
+        mFilterList << KVirtualSystemDescriptionType_License;
+    }
 };
-
-class VirtualSystemModel: public QAbstractItemModel
-{
-
-public:
-    VirtualSystemModel (QVector<CVirtualSystemDescription>& aVSDs, QObject *aParent = NULL);
-
-    inline QModelIndex index (int aRow, int aColumn, const QModelIndex &aParent = QModelIndex()) const;
-    inline QModelIndex parent (const QModelIndex &aIndex) const;
-    inline int rowCount (const QModelIndex &aParent = QModelIndex()) const;
-    inline int columnCount (const QModelIndex &aParent = QModelIndex()) const;
-    inline bool setData (const QModelIndex &aIndex, const QVariant &aValue, int aRole);
-    inline QVariant data (const QModelIndex &aIndex, int aRole = Qt::DisplayRole) const;
-    inline Qt::ItemFlags flags (const QModelIndex &aIndex) const;
-    inline QVariant headerData (int aSection, Qt::Orientation aOrientation, int aRole) const;
-
-    inline void restoreDefaults (const QModelIndex& aParent = QModelIndex());
-    inline void putBack();
-
-private:
-    /* Private member vars */
-    ModelItem *mRootItem;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// ModelItem
-
-enum ModelItemType { RootType, VirtualSystemType, HardwareType };
-
-/* This & the following derived classes represent the data items of a Virtual
-   System. All access/manipulation is done with the help of virtual functions
-   to keep the interface clean. ModelItem is able to handle tree structures
-   with a parent & several children's. */
-class ModelItem
-{
-public:
-    ModelItem (int aNumber, ModelItemType aType, ModelItem *aParent = NULL)
-      : mNumber (aNumber)
-      , mType (aType)
-      , mParentItem (aParent)
-    {}
-
-    ~ModelItem()
-    {
-        qDeleteAll (mChildItems);
-    }
-
-    ModelItem *parent() const { return mParentItem; }
-
-    void appendChild (ModelItem *aChild)
-    {
-        AssertPtr (aChild);
-        mChildItems << aChild;
-    }
-    ModelItem * child (int aRow) const { return mChildItems.value (aRow); }
-
-    int row() const
-    {
-        if (mParentItem)
-            return mParentItem->mChildItems.indexOf (const_cast<ModelItem*> (this));
-
-        return 0;
-    }
-
-    int childCount() const { return mChildItems.count(); }
-    int columnCount() const { return 3; }
-
-    virtual Qt::ItemFlags itemFlags (int /* aColumn */) const { return 0; }
-    virtual bool setData (int /* aColumn */, const QVariant & /* aValue */, int /* aRole */) { return false; }
-    virtual QVariant data (int /* aColumn */, int /* aRole */) const { return QVariant(); }
-    virtual QWidget * createEditor (QWidget * /* aParent */, const QStyleOptionViewItem & /* aOption */, const QModelIndex & /* aIndex */) const { return NULL; }
-    virtual bool setEditorData (QWidget * /* aEditor */, const QModelIndex & /* aIndex */) const { return false; }
-    virtual bool setModelData (QWidget * /* aEditor */, QAbstractItemModel * /* aModel */, const QModelIndex & /* aIndex */) { return false; }
-
-    virtual void restoreDefaults() {}
-    virtual void putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues)
-    {
-        for (int i = 0; i < childCount(); ++i)
-            child (i)->putBack (aFinalStates, aFinalValues, aFinalExtraValues);
-    }
-
-    ModelItemType type() const { return mType; }
-
-protected:
-    int mNumber;
-    ModelItemType mType;
-
-    ModelItem *mParentItem;
-    QList<ModelItem*> mChildItems;
-};
-
-/* This class represent a Virtual System with an index. */
-class VirtualSystemItem: public ModelItem
-{
-public:
-    VirtualSystemItem (int aNumber, CVirtualSystemDescription aDesc, ModelItem *aParent)
-      : ModelItem (aNumber, VirtualSystemType, aParent)
-      , mDesc (aDesc)
-    {}
-
-    virtual QVariant data (int aColumn, int aRole) const
-    {
-        QVariant v;
-        if (aColumn == DescriptionSection &&
-            aRole == Qt::DisplayRole)
-            v = VBoxImportApplianceWgt::tr ("Virtual System %1").arg (mNumber + 1);
-        return v;
-    }
-
-    virtual void putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues)
-    {
-        /* Resize the vectors */
-        unsigned long count = mDesc.GetCount();
-        aFinalStates.resize (count);
-        aFinalValues.resize (count);
-        aFinalExtraValues.resize (count);
-        /* Recursively fill the vectors */
-        ModelItem::putBack (aFinalStates, aFinalValues, aFinalExtraValues);
-        /* Set all final values at once */
-        mDesc.SetFinalValues (aFinalStates, aFinalValues, aFinalExtraValues);
-    }
-
-private:
-    CVirtualSystemDescription mDesc;
-};
-
-/* This class represent an hardware item of a Virtual System. All values of
-   KVirtualSystemDescriptionType are supported & handled differently. */
-class HardwareItem: public ModelItem
-{
-    friend class VirtualSystemSortProxyModel;
-public:
-
-    HardwareItem (int aNumber,
-                  KVirtualSystemDescriptionType aType,
-                  const QString &aRef,
-                  const QString &aOrigValue,
-                  const QString &aConfigValue,
-                  const QString &aExtraConfigValue,
-                  ModelItem *aParent)
-        : ModelItem (aNumber, HardwareType, aParent)
-        , mType (aType)
-        , mRef (aRef)
-        , mOrigValue (aOrigValue)
-        , mConfigValue (aConfigValue)
-        , mConfigDefaultValue (aConfigValue)
-        , mExtraConfigValue (aExtraConfigValue)
-        , mCheckState (Qt::Checked)
-    {}
-
-    virtual void putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues)
-    {
-        aFinalStates[mNumber] = mCheckState == Qt::Checked;
-        aFinalValues[mNumber] = mConfigValue;
-        aFinalExtraValues[mNumber] = mExtraConfigValue;
-        ModelItem::putBack (aFinalStates, aFinalValues, aFinalExtraValues);
-    }
-
-    bool setData (int aColumn, const QVariant &aValue, int aRole)
-    {
-        bool fDone = false;
-        switch (aRole)
-        {
-            case Qt::CheckStateRole:
-            {
-                if (aColumn == ConfigValueSection &&
-                    (mType == KVirtualSystemDescriptionType_Floppy ||
-                     mType == KVirtualSystemDescriptionType_CDROM ||
-                     mType == KVirtualSystemDescriptionType_USBController ||
-                     mType == KVirtualSystemDescriptionType_SoundCard ||
-                     mType == KVirtualSystemDescriptionType_NetworkAdapter))
-                {
-                    mCheckState = static_cast<Qt::CheckState> (aValue.toInt());
-                    fDone = true;
-                }
-                break;
-            }
-            default: break;
-        }
-        return fDone;
-    }
-
-    virtual QVariant data (int aColumn, int aRole) const
-    {
-        QVariant v;
-        switch (aRole)
-        {
-            case Qt::DisplayRole:
-            {
-                if (aColumn == DescriptionSection)
-                {
-                    switch (mType)
-                    {
-                        case KVirtualSystemDescriptionType_Name: v = VBoxImportApplianceWgt::tr ("Name"); break;
-                        case KVirtualSystemDescriptionType_Description: v = VBoxImportApplianceWgt::tr ("Description"); break;
-                        case KVirtualSystemDescriptionType_OS: v = VBoxImportApplianceWgt::tr ("Guest OS Type"); break;
-                        case KVirtualSystemDescriptionType_CPU: v = VBoxImportApplianceWgt::tr ("CPU"); break;
-                        case KVirtualSystemDescriptionType_Memory: v = VBoxImportApplianceWgt::tr ("RAM"); break;
-                        case KVirtualSystemDescriptionType_HardDiskControllerIDE: v = VBoxImportApplianceWgt::tr ("Hard Disk Controller IDE"); break;
-                        case KVirtualSystemDescriptionType_HardDiskControllerSATA: v = VBoxImportApplianceWgt::tr ("Hard Disk Controller SATA"); break;
-                        case KVirtualSystemDescriptionType_HardDiskControllerSCSI: v = VBoxImportApplianceWgt::tr ("Hard Disk Controller SCSI"); break;
-                        case KVirtualSystemDescriptionType_CDROM: v = VBoxImportApplianceWgt::tr ("DVD"); break;
-                        case KVirtualSystemDescriptionType_Floppy: v = VBoxImportApplianceWgt::tr ("Floppy"); break;
-                        case KVirtualSystemDescriptionType_NetworkAdapter: v = VBoxImportApplianceWgt::tr ("Network Adapter"); break;
-                        case KVirtualSystemDescriptionType_USBController: v = VBoxImportApplianceWgt::tr ("USB Controller"); break;
-                        case KVirtualSystemDescriptionType_SoundCard: v = VBoxImportApplianceWgt::tr ("Sound Card"); break;
-                        case KVirtualSystemDescriptionType_HardDiskImage: v = VBoxImportApplianceWgt::tr ("Virtual Disk Image"); break;
-                        default: v = VBoxImportApplianceWgt::tr ("Unknown Hardware Item"); break;
-                    }
-                }
-                else if (aColumn == OriginalValueSection)
-                    v = mOrigValue;
-                else if (aColumn == ConfigValueSection)
-                {
-                    switch (mType)
-                    {
-                        case KVirtualSystemDescriptionType_OS: v = vboxGlobal().vmGuestOSTypeDescription (mConfigValue); break;
-                        case KVirtualSystemDescriptionType_Memory: v = mConfigValue + " " + VBoxImportApplianceWgt::tr ("MB"); break;
-                        case KVirtualSystemDescriptionType_SoundCard: v = vboxGlobal().toString (static_cast<KAudioControllerType> (mConfigValue.toInt())); break;
-                        case KVirtualSystemDescriptionType_NetworkAdapter: v = vboxGlobal().toString (static_cast<KNetworkAdapterType> (mConfigValue.toInt())); break;
-                        default: v = mConfigValue; break;
-                    }
-                }
-                break;
-            }
-            case Qt::ToolTipRole:
-            {
-                if (aColumn == ConfigValueSection)
-                {
-                    if (!mOrigValue.isEmpty())
-                        v = VBoxImportApplianceWgt::tr ("<b>Original Value:</b> %1").arg (mOrigValue);
-                }
-                break;
-            }
-            case Qt::DecorationRole:
-            {
-                if (aColumn == DescriptionSection)
-                {
-                    switch (mType)
-                    {
-                        case KVirtualSystemDescriptionType_Name: v = QIcon (":/name_16px.png"); break;
-                        case KVirtualSystemDescriptionType_Description: v = QIcon (":/description_16px.png"); break;
-                        case KVirtualSystemDescriptionType_OS: v = QIcon (":/os_type_16px.png"); break;
-                        case KVirtualSystemDescriptionType_CPU: v = QIcon (":/cpu_16px.png"); break;
-                        case KVirtualSystemDescriptionType_Memory: v = QIcon (":/ram_16px.png"); break;
-                        case KVirtualSystemDescriptionType_HardDiskControllerIDE: v = QIcon (":/ide_16px.png"); break;
-                        case KVirtualSystemDescriptionType_HardDiskControllerSATA: v = QIcon (":/sata_16px.png"); break;
-                        case KVirtualSystemDescriptionType_HardDiskControllerSCSI: v = QIcon (":/scsi_16px.png"); break;
-                        case KVirtualSystemDescriptionType_HardDiskImage: v = QIcon (":/hd_16px.png"); break;
-                        case KVirtualSystemDescriptionType_CDROM: v = QIcon (":/cd_16px.png"); break;
-                        case KVirtualSystemDescriptionType_Floppy: v = QIcon (":/fd_16px.png"); break;
-                        case KVirtualSystemDescriptionType_NetworkAdapter: v = QIcon (":/nw_16px.png"); break;
-                        case KVirtualSystemDescriptionType_USBController: v = QIcon (":/usb_16px.png"); break;
-                        case KVirtualSystemDescriptionType_SoundCard: v = QIcon (":/sound_16px.png"); break;
-                        default: break;
-                    }
-                }
-                else if (aColumn == ConfigValueSection &&
-                         mType == KVirtualSystemDescriptionType_OS)
-                {
-                    v = vboxGlobal().vmGuestOSTypeIcon (mConfigValue).scaledToHeight (16, Qt::SmoothTransformation);
-                }
-                break;
-            }
-            case Qt::FontRole:
-            {
-                /* If the item is unchecked mark it with italic text. */
-                if (aColumn == ConfigValueSection &&
-                    mCheckState == Qt::Unchecked)
-                {
-                    QFont font = qApp->font();
-                    font.setItalic (true);
-                    v = font;
-                }
-                break;
-            }
-            case Qt::ForegroundRole:
-            {
-                /* If the item is unchecked mark it with gray text. */
-                if (aColumn == ConfigValueSection &&
-                    mCheckState == Qt::Unchecked)
-                {
-                    QPalette pal = qApp->palette();
-                    v = pal.brush (QPalette::Disabled, QPalette::WindowText);
-                }
-                break;
-            }
-            case Qt::CheckStateRole:
-            {
-                if (aColumn == ConfigValueSection &&
-                    (mType == KVirtualSystemDescriptionType_Floppy ||
-                     mType == KVirtualSystemDescriptionType_CDROM ||
-                     mType == KVirtualSystemDescriptionType_USBController ||
-                     mType == KVirtualSystemDescriptionType_SoundCard ||
-                     mType == KVirtualSystemDescriptionType_NetworkAdapter))
-                    v = mCheckState;
-                break;
-            }
-        }
-        return v;
-    }
-
-    virtual Qt::ItemFlags itemFlags (int aColumn) const
-    {
-        Qt::ItemFlags flags = 0;
-        if (aColumn == ConfigValueSection)
-        {
-            /* Some items are checkable */
-            if (mType == KVirtualSystemDescriptionType_Floppy ||
-                mType == KVirtualSystemDescriptionType_CDROM ||
-                mType == KVirtualSystemDescriptionType_USBController ||
-                mType == KVirtualSystemDescriptionType_SoundCard ||
-                mType == KVirtualSystemDescriptionType_NetworkAdapter)
-                flags |= Qt::ItemIsUserCheckable;
-            /* Some items are editable */
-            if ((mType == KVirtualSystemDescriptionType_Name ||
-                 mType == KVirtualSystemDescriptionType_Description ||
-                 mType == KVirtualSystemDescriptionType_OS ||
-                 mType == KVirtualSystemDescriptionType_Memory ||
-                 mType == KVirtualSystemDescriptionType_SoundCard ||
-                 mType == KVirtualSystemDescriptionType_NetworkAdapter ||
-                 mType == KVirtualSystemDescriptionType_HardDiskControllerIDE ||
-                 mType == KVirtualSystemDescriptionType_HardDiskImage) &&
-                mCheckState == Qt::Checked) /* Item has to be enabled */
-                flags |= Qt::ItemIsEditable;
-        }
-        return flags;
-    }
-
-    virtual QWidget * createEditor (QWidget *aParent, const QStyleOptionViewItem & /* aOption */, const QModelIndex &aIndex) const
-    {
-        QWidget *editor = NULL;
-        if (aIndex.column() == ConfigValueSection)
-        {
-            switch (mType)
-            {
-                case KVirtualSystemDescriptionType_OS:
-                {
-                    VBoxOSTypeSelectorButton *e = new VBoxOSTypeSelectorButton (aParent);
-                    /* Fill the background with the highlight color in the case
-                     * the button hasn't a rectangle shape. This prevents the
-                     * display of parts from the current text on the Mac. */
-                    e->setAutoFillBackground (true);
-                    e->setBackgroundRole (QPalette::Highlight);
-                    editor = e;
-                    break;
-                }
-                case KVirtualSystemDescriptionType_Name:
-                {
-                    QLineEdit *e = new QLineEdit (aParent);
-                    editor = e;
-                    break;
-                }
-                case KVirtualSystemDescriptionType_Description:
-                {
-                    QTextEdit *e = new QTextEdit (aParent);
-                    editor = e;
-                    break;
-                }
-                case KVirtualSystemDescriptionType_CPU:
-                {
-                    QSpinBox *e = new QSpinBox (aParent);
-                    e->setRange (VBoxImportApplianceWgt::minGuestCPUCount(), VBoxImportApplianceWgt::maxGuestCPUCount());
-                    editor = e;
-                    break;
-                }
-                case KVirtualSystemDescriptionType_Memory:
-                {
-                    QSpinBox *e = new QSpinBox (aParent);
-                    e->setRange (VBoxImportApplianceWgt::minGuestRAM(), VBoxImportApplianceWgt::maxGuestRAM());
-                    e->setSuffix (" " + VBoxImportApplianceWgt::tr ("MB"));
-                    editor = e;
-                    break;
-                }
-                case KVirtualSystemDescriptionType_SoundCard:
-                {
-                    QComboBox *e = new QComboBox (aParent);
-                    e->addItem (vboxGlobal().toString (KAudioControllerType_AC97), KAudioControllerType_AC97);
-                    e->addItem (vboxGlobal().toString (KAudioControllerType_SB16), KAudioControllerType_SB16);
-                    editor = e;
-                    break;
-                }
-                case KVirtualSystemDescriptionType_NetworkAdapter:
-                {
-                    QComboBox *e = new QComboBox (aParent);
-                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_Am79C970A), KNetworkAdapterType_Am79C970A);
-                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_Am79C973), KNetworkAdapterType_Am79C973);
-#ifdef VBOX_WITH_E1000
-                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_I82540EM), KNetworkAdapterType_I82540EM);
-                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_I82543GC), KNetworkAdapterType_I82543GC);
-#endif /* VBOX_WITH_E1000 */
-                    editor = e;
-                    break;
-                }
-                case KVirtualSystemDescriptionType_HardDiskControllerIDE:
-                {
-                    QComboBox *e = new QComboBox (aParent);
-                    e->addItem (vboxGlobal().toString (KStorageControllerType_PIIX3), "PIIX3");
-                    e->addItem (vboxGlobal().toString (KStorageControllerType_PIIX4), "PIIX4");
-                    e->addItem (vboxGlobal().toString (KStorageControllerType_ICH6),  "ICH6");
-                    editor = e;
-                    break;
-                }
-                case KVirtualSystemDescriptionType_HardDiskImage:
-                {
-                /* disabled for now
-                    VBoxFilePathSelectorWidget *e = new VBoxFilePathSelectorWidget (aParent);
-                    e->setMode (VBoxFilePathSelectorWidget::Mode_File);
-                    e->setResetEnabled (false);
-                */
-                    QLineEdit *e = new QLineEdit (aParent);
-                    editor = e;
-                    break;
-                }
-                default: break;
-            }
-        }
-        return editor;
-    }
-
-    virtual bool setEditorData (QWidget *aEditor, const QModelIndex & /* aIndex */) const
-    {
-        bool fDone = false;
-        switch (mType)
-        {
-            case KVirtualSystemDescriptionType_OS:
-            {
-                if (VBoxOSTypeSelectorButton *e = qobject_cast<VBoxOSTypeSelectorButton*> (aEditor))
-                {
-                    e->setOSTypeId (mConfigValue);
-                    fDone = true;
-                }
-                break;
-            }
-            case KVirtualSystemDescriptionType_HardDiskControllerIDE:
-            {
-                if (QComboBox *e = qobject_cast<QComboBox*> (aEditor))
-                {
-                    int i = e->findData (mConfigValue);
-                    if (i != -1)
-                        e->setCurrentIndex (i);
-                    fDone = true;
-                }
-                break;
-            }
-            case KVirtualSystemDescriptionType_CPU:
-            case KVirtualSystemDescriptionType_Memory:
-            {
-                if (QSpinBox *e = qobject_cast<QSpinBox*> (aEditor))
-                {
-                    e->setValue (mConfigValue.toInt());
-                    fDone = true;
-                }
-                break;
-            }
-            case KVirtualSystemDescriptionType_Name:
-            {
-                if (QLineEdit *e = qobject_cast<QLineEdit*> (aEditor))
-                {
-                    e->setText (mConfigValue);
-                    fDone = true;
-                }
-                break;
-            }
-            case KVirtualSystemDescriptionType_Description:
-            {
-                if (QTextEdit *e = qobject_cast<QTextEdit*> (aEditor))
-                {
-                    e->setPlainText (mConfigValue);
-                    fDone = true;
-                }
-                break;
-            }
-            case KVirtualSystemDescriptionType_SoundCard:
-            case KVirtualSystemDescriptionType_NetworkAdapter:
-            {
-                if (QComboBox *e = qobject_cast<QComboBox*> (aEditor))
-                {
-                    int i = e->findData (mConfigValue.toInt());
-                    if (i != -1)
-                        e->setCurrentIndex (i);
-                    fDone = true;
-                }
-                break;
-            }
-            case KVirtualSystemDescriptionType_HardDiskImage:
-            {
-                /* disabled for now
-                if (VBoxFilePathSelectorWidget *e = qobject_cast<VBoxFilePathSelectorWidget*> (aEditor))
-                {
-                    e->setPath (mConfigValue);
-                */
-                if (QLineEdit *e = qobject_cast<QLineEdit*> (aEditor))
-                {
-                    e->setText (mConfigValue);
-                    fDone = true;
-                }
-                break;
-            }
-            default: break;
-        }
-        return fDone;
-    }
-
-    virtual bool setModelData (QWidget *aEditor, QAbstractItemModel * /* aModel */, const QModelIndex & /* aIndex */)
-    {
-        bool fDone = false;
-        switch (mType)
-        {
-            case KVirtualSystemDescriptionType_OS:
-            {
-                if (VBoxOSTypeSelectorButton *e = qobject_cast<VBoxOSTypeSelectorButton*> (aEditor))
-                {
-                    mConfigValue = e->osTypeId();
-                    fDone = true;
-                }
-                break;
-            }
-            case KVirtualSystemDescriptionType_HardDiskControllerIDE:
-            {
-                if (QComboBox *e = qobject_cast<QComboBox*> (aEditor))
-                {
-                    mConfigValue = e->itemData (e->currentIndex()).toString();
-                    fDone = true;
-                }
-                break;
-            }
-            case KVirtualSystemDescriptionType_CPU:
-            case KVirtualSystemDescriptionType_Memory:
-            {
-                if (QSpinBox *e = qobject_cast<QSpinBox*> (aEditor))
-                {
-                    mConfigValue = QString::number (e->value());
-                    fDone = true;
-                }
-                break;
-            }
-            case KVirtualSystemDescriptionType_Name:
-            {
-                if (QLineEdit *e = qobject_cast<QLineEdit*> (aEditor))
-                {
-                    mConfigValue = e->text();
-                    fDone = true;
-                }
-                break;
-            }
-            case KVirtualSystemDescriptionType_Description:
-            {
-                if (QTextEdit *e = qobject_cast<QTextEdit*> (aEditor))
-                {
-                    mConfigValue = e->toPlainText();
-                    fDone = true;
-                }
-                break;
-            }
-            case KVirtualSystemDescriptionType_SoundCard:
-            case KVirtualSystemDescriptionType_NetworkAdapter:
-            {
-                if (QComboBox *e = qobject_cast<QComboBox*> (aEditor))
-                {
-                    mConfigValue = e->itemData (e->currentIndex()).toString();
-                    fDone = true;
-                }
-                break;
-            }
-            case KVirtualSystemDescriptionType_HardDiskImage:
-            {
-                /* disabled for now
-                if (VBoxFilePathSelectorWidget *e = qobject_cast<VBoxFilePathSelectorWidget*> (aEditor))
-                {
-                    mConfigValue = e->path();
-                */
-                if (QLineEdit *e = qobject_cast<QLineEdit*> (aEditor))
-                {
-                    mConfigValue = e->text();
-                    fDone = true;
-                }
-                break;
-            }
-            default: break;
-        }
-        return fDone;
-    }
-
-    virtual void restoreDefaults()
-    {
-        mConfigValue = mConfigDefaultValue;
-        mCheckState = Qt::Checked;
-    }
-
-private:
-
-    /* Private member vars */
-    KVirtualSystemDescriptionType mType;
-    QString mRef;
-    QString mOrigValue;
-    QString mConfigValue;
-    QString mConfigDefaultValue;
-    QString mExtraConfigValue;
-    Qt::CheckState mCheckState;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// VirtualSystemDelegate
-
-/* The delegate is used for creating/handling the different editors for the
-   various types we support. This class forward the requests to the virtual
-   methods of our different ModelItems. If this is not possible the default
-   methods of QItemDelegate are used to get some standard behavior. Note: We
-   have to handle the proxy model ourself. I really don't understand why Qt is
-   not doing this for us. */
-class VirtualSystemDelegate: public QItemDelegate
-{
-public:
-    VirtualSystemDelegate (QAbstractProxyModel *aProxy, QObject *aParent = NULL)
-        : QItemDelegate (aParent)
-        , mProxy (aProxy)
-    {}
-
-    QWidget * createEditor (QWidget *aParent, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const
-    {
-        if (!aIndex.isValid())
-            return QItemDelegate::createEditor (aParent, aOption, aIndex);
-
-        QModelIndex index (aIndex);
-        if (mProxy)
-            index = mProxy->mapToSource (aIndex);
-
-        ModelItem *item = static_cast<ModelItem*> (index.internalPointer());
-        QWidget *editor = item->createEditor (aParent, aOption, index);
-
-        if (editor == NULL)
-            return QItemDelegate::createEditor (aParent, aOption, index);
-        else
-            return editor;
-    }
-
-    void setEditorData (QWidget *aEditor, const QModelIndex &aIndex) const
-    {
-        if (!aIndex.isValid())
-            return QItemDelegate::setEditorData (aEditor, aIndex);
-
-        QModelIndex index (aIndex);
-        if (mProxy)
-            index = mProxy->mapToSource (aIndex);
-
-        ModelItem *item = static_cast<ModelItem*> (index.internalPointer());
-
-        if (!item->setEditorData (aEditor, index))
-            QItemDelegate::setEditorData (aEditor, index);
-    }
-
-    void setModelData (QWidget *aEditor, QAbstractItemModel *aModel, const QModelIndex &aIndex) const
-    {
-        if (!aIndex.isValid())
-            return QItemDelegate::setModelData (aEditor, aModel, aIndex);
-
-        QModelIndex index = aModel->index (aIndex.row(), aIndex.column());
-        if (mProxy)
-            index = mProxy->mapToSource (aIndex);
-
-        ModelItem *item = static_cast<ModelItem*> (index.internalPointer());
-        if (!item->setModelData (aEditor, aModel, index))
-            QItemDelegate::setModelData (aEditor, aModel, aIndex);
-    }
-
-    void updateEditorGeometry (QWidget *aEditor, const QStyleOptionViewItem &aOption, const QModelIndex & /* aIndex */) const
-    {
-        if (aEditor)
-            aEditor->setGeometry (aOption.rect);
-    }
-
-    QSize sizeHint (const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const
-    {
-        QSize size = QItemDelegate::sizeHint (aOption, aIndex);
-#ifdef Q_WS_MAC
-        int h = 28;
-#else /* Q_WS_MAC */
-        int h = 24;
-#endif /* Q_WS_MAC */
-        size.setHeight (RT_MAX (h, size.height()));
-        return size;
-    }
-private:
-    /* Private member vars */
-    QAbstractProxyModel *mProxy;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// VirtualSystemSortProxyModel
-
-/* How to sort the items in the tree view */
-KVirtualSystemDescriptionType VirtualSystemSortProxyModel::mSortList[] =
-{
-    KVirtualSystemDescriptionType_Name,
-    KVirtualSystemDescriptionType_Description,
-    KVirtualSystemDescriptionType_OS,
-    KVirtualSystemDescriptionType_License,
-    KVirtualSystemDescriptionType_CPU,
-    KVirtualSystemDescriptionType_Memory,
-    KVirtualSystemDescriptionType_Floppy,
-    KVirtualSystemDescriptionType_CDROM,
-    KVirtualSystemDescriptionType_USBController,
-    KVirtualSystemDescriptionType_SoundCard,
-    KVirtualSystemDescriptionType_NetworkAdapter,
-    KVirtualSystemDescriptionType_HardDiskControllerIDE,
-    KVirtualSystemDescriptionType_HardDiskControllerSATA,
-    KVirtualSystemDescriptionType_HardDiskControllerSCSI
-};
-
-VirtualSystemSortProxyModel::VirtualSystemSortProxyModel (QObject *aParent)
-    : QSortFilterProxyModel (aParent)
-{}
-
-bool VirtualSystemSortProxyModel::filterAcceptsRow (int aSourceRow, const QModelIndex & aSourceParent) const
-{
-    /* By default enable all, we will explicitly filter out below */
-    if (aSourceParent.isValid())
-    {
-        QModelIndex i = aSourceParent.child (aSourceRow, 0);
-        if (i.isValid())
-        {
-            ModelItem *item = static_cast<ModelItem*> (i.internalPointer());
-            /* We filter hardware types only */
-            if (item->type() == HardwareType)
-            {
-                HardwareItem *hwItem = static_cast<HardwareItem*> (item);
-                /* The license type shouldn't be displayed */
-                if (hwItem->mType == KVirtualSystemDescriptionType_License)
-                    return false;
-            }
-        }
-    }
-    return true;
-}
-
-bool VirtualSystemSortProxyModel::lessThan (const QModelIndex &aLeft, const QModelIndex &aRight) const
-{
-    if (!aLeft.isValid() ||
-        !aRight.isValid())
-        return false;
-
-    ModelItem *leftItem = static_cast<ModelItem*> (aLeft.internalPointer());
-    ModelItem *rightItem = static_cast<ModelItem*> (aRight.internalPointer());
-
-    /* We sort hardware types only */
-    if (!(leftItem->type() == HardwareType &&
-          rightItem->type() == HardwareType))
-        return false;
-
-    HardwareItem *hwLeft = static_cast<HardwareItem*> (leftItem);
-    HardwareItem *hwRight = static_cast<HardwareItem*> (rightItem);
-
-    for (unsigned int i = 0; i < RT_ELEMENTS (mSortList); ++i)
-        if (hwLeft->mType == mSortList[i])
-        {
-            for (unsigned int a = 0; a <= i; ++a)
-                if (hwRight->mType == mSortList[a])
-                    return true;
-            return false;
-        }
-
-    return true;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VirtualSystemModel
-
-/* This class is a wrapper model for our ModelItem. It could be used with any
-   TreeView & forward mostly all calls to the methods of ModelItem. The
-   ModelItems itself are stored as internal pointers in the QModelIndex class. */
-VirtualSystemModel::VirtualSystemModel (QVector<CVirtualSystemDescription>& aVSDs, QObject *aParent /* = NULL */)
-   : QAbstractItemModel (aParent)
-{
-    mRootItem = new ModelItem (0, RootType);
-    for (int a = 0; a < aVSDs.size(); ++a)
-    {
-        CVirtualSystemDescription vs = aVSDs[a];
-
-        VirtualSystemItem *vi = new VirtualSystemItem (a, vs, mRootItem);
-        mRootItem->appendChild (vi);
-
-        /* @todo: ask Dmitry about include/COMDefs.h:232 */
-        QVector<KVirtualSystemDescriptionType> types;
-        QVector<QString> refs;
-        QVector<QString> origValues;
-        QVector<QString> configValues;
-        QVector<QString> extraConfigValues;
-
-        QList<int> hdIndizies;
-        QMap<int, HardwareItem*> controllerMap;
-        vs.GetDescription (types, refs, origValues, configValues, extraConfigValues);
-        for (int i = 0; i < types.size(); ++i)
-        {
-            /* We add the hard disk images in an second step, so save a
-               reference to them. */
-            if (types[i] == KVirtualSystemDescriptionType_HardDiskImage)
-                hdIndizies << i;
-            else
-            {
-                HardwareItem *hi = new HardwareItem (i, types[i], refs[i], origValues[i], configValues[i], extraConfigValues[i], vi);
-                vi->appendChild (hi);
-                /* Save the hard disk controller types in an extra map */
-                if (types[i] == KVirtualSystemDescriptionType_HardDiskControllerIDE ||
-                    types[i] == KVirtualSystemDescriptionType_HardDiskControllerSATA ||
-                    types[i] == KVirtualSystemDescriptionType_HardDiskControllerSCSI)
-                    controllerMap[i] = hi;
-            }
-        }
-        QRegExp rx ("controller=(\\d+);?");
-        /* Now process the hard disk images */
-        for (int a = 0; a < hdIndizies.size(); ++a)
-        {
-            int i = hdIndizies[a];
-            QString ecnf = extraConfigValues[i];
-            if (rx.indexIn (ecnf) != -1)
-            {
-                /* Get the controller */
-                HardwareItem *ci = controllerMap[rx.cap (1).toInt()];
-                if (ci)
-                {
-                    /* New hardware item as child of the controller */
-                    HardwareItem *hi = new HardwareItem (i, types[i], refs[i], origValues[i], configValues[i], extraConfigValues[i], ci);
-                    ci->appendChild (hi);
-                }
-            }
-        }
-    }
-}
-
-QModelIndex VirtualSystemModel::index (int aRow, int aColumn, const QModelIndex &aParent /* = QModelIndex() */) const
-{
-    if (!hasIndex (aRow, aColumn, aParent))
-        return QModelIndex();
-
-    ModelItem *parentItem;
-
-    if (!aParent.isValid())
-        parentItem = mRootItem;
-    else
-        parentItem = static_cast<ModelItem*> (aParent.internalPointer());
-
-    ModelItem *childItem = parentItem->child (aRow);
-    if (childItem)
-        return createIndex (aRow, aColumn, childItem);
-    else
-        return QModelIndex();
-}
-
-QModelIndex VirtualSystemModel::parent (const QModelIndex &aIndex) const
-{
-    if (!aIndex.isValid())
-        return QModelIndex();
-
-    ModelItem *childItem = static_cast<ModelItem*> (aIndex.internalPointer());
-    ModelItem *parentItem = childItem->parent();
-
-    if (parentItem == mRootItem)
-        return QModelIndex();
-
-    return createIndex (parentItem->row(), 0, parentItem);
-}
-
-int VirtualSystemModel::rowCount (const QModelIndex &aParent /* = QModelIndex() */) const
-{
-    ModelItem *parentItem;
-    if (aParent.column() > 0)
-        return 0;
-
-    if (!aParent.isValid())
-        parentItem = mRootItem;
-    else
-        parentItem = static_cast<ModelItem*> (aParent.internalPointer());
-
-    return parentItem->childCount();
-}
-
-int VirtualSystemModel::columnCount (const QModelIndex &aParent /* = QModelIndex() */) const
-{
-    if (aParent.isValid())
-        return static_cast<ModelItem*> (aParent.internalPointer())->columnCount();
-    else
-        return mRootItem->columnCount();
-}
-
-bool VirtualSystemModel::setData (const QModelIndex &aIndex, const QVariant &aValue, int aRole)
-{
-    if (!aIndex.isValid())
-        return false;
-
-    ModelItem *item = static_cast<ModelItem*> (aIndex.internalPointer());
-
-    return item->setData (aIndex.column(), aValue, aRole);
-}
-
-QVariant VirtualSystemModel::data (const QModelIndex &aIndex, int aRole /* = Qt::DisplayRole */) const
-{
-    if (!aIndex.isValid())
-        return QVariant();
-
-    ModelItem *item = static_cast<ModelItem*> (aIndex.internalPointer());
-
-    return item->data (aIndex.column(), aRole);
-}
-
-Qt::ItemFlags VirtualSystemModel::flags (const QModelIndex &aIndex) const
-{
-    if (!aIndex.isValid())
-        return 0;
-
-    ModelItem *item = static_cast<ModelItem*> (aIndex.internalPointer());
-
-    return Qt::ItemIsEnabled | Qt::ItemIsSelectable | item->itemFlags (aIndex.column());
-}
-
-QVariant VirtualSystemModel::headerData (int aSection, Qt::Orientation aOrientation, int aRole) const
-{
-    if (aRole != Qt::DisplayRole ||
-        aOrientation != Qt::Horizontal)
-        return QVariant();
-
-    QString title;
-    switch (aSection)
-    {
-        case DescriptionSection: title = VBoxImportApplianceWgt::tr ("Description"); break;
-        case ConfigValueSection: title = VBoxImportApplianceWgt::tr ("Configuration"); break;
-    }
-    return title;
-}
-
-void VirtualSystemModel::restoreDefaults (const QModelIndex& aParent /* = QModelIndex() */)
-{
-    ModelItem *parentItem;
-
-    if (!aParent.isValid())
-        parentItem = mRootItem;
-    else
-        parentItem = static_cast<ModelItem*> (aParent.internalPointer());
-
-    for (int i = 0; i < parentItem->childCount(); ++i)
-    {
-        parentItem->child (i)->restoreDefaults();
-        restoreDefaults (index (i, 0, aParent));
-    }
-    emit dataChanged (index (0, 0, aParent), index (parentItem->childCount()-1, 0, aParent));
-}
-
-void VirtualSystemModel::putBack()
-{
-    QVector<BOOL> v1;
-    QVector<QString> v2;
-    QVector<QString> v3;
-    mRootItem->putBack (v1, v2, v3);
-}
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1022,22 +48,8 @@
 
 VBoxImportApplianceWgt::VBoxImportApplianceWgt (QWidget *aParent)
-    : QIWithRetranslateUI<QWidget> (aParent)
-    , mAppliance (NULL)
-    , mModel (NULL)
+    : VBoxApplianceEditorWgt (aParent)
 {
     /* Make sure all static content is properly initialized */
     initSystemSettings();
-
-    /* Apply UI decorations */
-    Ui::VBoxImportApplianceWgt::setupUi (this);
-
-    /* Make the tree looking nicer */
-    mTvSettings->setRootIsDecorated (false);
-    mTvSettings->setAlternatingRowColors (true);
-    mTvSettings->header()->setStretchLastSection (true);
-    mTvSettings->header()->setResizeMode (QHeaderView::ResizeToContents);
-
-    /* Applying language settings */
-    retranslateUi();
 }
 
@@ -1070,5 +82,5 @@
                     mModel = new VirtualSystemModel (vsds, this);
 
-                    VirtualSystemSortProxyModel *proxy = new VirtualSystemSortProxyModel (this);
+                    ImportSortProxyModel *proxy = new ImportSortProxyModel (this);
                     proxy->setSourceModel (mModel);
                     proxy->sort (DescriptionSection, Qt::DescendingOrder);
@@ -1163,15 +175,4 @@
 }
 
-void VBoxImportApplianceWgt::restoreDefaults()
-{
-    mModel->restoreDefaults();
-}
-
-void VBoxImportApplianceWgt::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxImportApplianceWgt::retranslateUi (this);
-}
-
 /* static */
 void VBoxImportApplianceWgt::initSystemSettings()
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxLineTextEdit.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxLineTextEdit.cpp	(revision 18378)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxLineTextEdit.cpp	(revision 18378)
@@ -0,0 +1,121 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxLineTextEdit class definitions
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+/* VBox includes */
+#include "VBoxLineTextEdit.h"
+#include "VBoxGlobal.h"
+
+/* Qt includes */
+#include <QPushButton>
+#include <QLineEdit>
+#include <QDialogButtonBox>
+#include <QFile>
+#include <QTextStream>
+#include <QTextEdit>
+
+////////////////////////////////////////////////////////////////////////////////
+// VBoxTextEditor
+
+VBoxTextEditor::VBoxTextEditor (QWidget *aParent /* = NULL */)
+  : QIWithRetranslateUI<QIDialog> (aParent)
+{
+    QVBoxLayout *mainLayout = new QVBoxLayout (this);
+    mainLayout->setMargin (12);
+
+    /* We need a text editor */
+    mTextEdit = new QTextEdit (this);
+    mainLayout->addWidget (mTextEdit);
+    /* and some buttons to interact with */
+    mButtonBox = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    mOpenBtn = new QPushButton (this);
+    mButtonBox->addButton (mOpenBtn, QDialogButtonBox::ActionRole);
+    mainLayout->addWidget (mButtonBox);
+    /* Connect the buttons so that they are useful */
+    connect (mButtonBox, SIGNAL (accepted()),
+             this, SLOT (accept()));
+    connect (mButtonBox, SIGNAL (rejected()),
+             this, SLOT (reject()));
+    connect (mOpenBtn, SIGNAL (clicked()),
+             this, SLOT (open()));
+
+    /* Applying language settings */
+    retranslateUi();
+}
+
+void VBoxTextEditor::setText (const QString& aText)
+{
+    mTextEdit->setText (aText);
+}
+
+QString VBoxTextEditor::text() const
+{
+    return mTextEdit->toPlainText();
+}
+
+void VBoxTextEditor::retranslateUi()
+{
+    setWindowTitle (tr ("Edit text"));
+    mOpenBtn->setText (tr ("&Replace..."));
+    mOpenBtn->setToolTip (tr ("Replaces the current text with the content of a given file."));
+}
+
+void VBoxTextEditor::open()
+{
+    QString fileName = vboxGlobal().getOpenFileName (vboxGlobal().documentsPath(), tr("Text (*.txt);;All (*.*)"), this, tr("Select a file to open..."));
+    if (!fileName.isEmpty())
+    {
+        QFile file (fileName);
+        if (file.open(QFile::ReadOnly))
+        {
+            QTextStream in (&file);
+            mTextEdit->setPlainText (in.readAll());
+        }
+    }
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// VBoxLineTextEdit
+
+VBoxLineTextEdit::VBoxLineTextEdit (QWidget *aParent /* = NULL */)
+  : QIWithRetranslateUI<QPushButton> (aParent)
+{
+    connect (this, SIGNAL (clicked()),
+             this, SLOT (edit()));
+
+    setFocusPolicy (Qt::StrongFocus);
+    retranslateUi();
+}
+
+void VBoxLineTextEdit::retranslateUi()
+{
+    QPushButton::setText (tr ("&Edit"));
+}
+
+void VBoxLineTextEdit::edit()
+{
+    VBoxTextEditor te (this);
+    te.setText (mText);
+    if (te.exec() == QDialog::Accepted)
+        mText = te.text();
+}
+
Index: trunk/src/VBox/Frontends/VirtualBox/ui/VBoxApplianceEditorWgt.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/ui/VBoxApplianceEditorWgt.ui	(revision 18378)
+++ trunk/src/VBox/Frontends/VirtualBox/ui/VBoxApplianceEditorWgt.ui	(revision 18378)
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <comment>
+ VBox frontends: Qt4 GUI (&quot;VirtualBox&quot;):
+
+ Copyright (C) 2009 Sun Microsystems, Inc.
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License (GPL) as published by the Free Software
+ Foundation, in version 2 as it comes in the "COPYING" file of the
+ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+ Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ Clara, CA 95054 USA or visit http://www.sun.com if you need
+ additional information or have any questions.
+ </comment>
+ <class>VBoxApplianceEditorWgt</class>
+ <widget class="QWidget" name="VBoxApplianceEditorWgt">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>459</width>
+    <height>305</height>
+   </rect>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <property name="margin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QTreeView" name="mTvSettings">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QWidget" name="mWarningWidget" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <property name="sizeConstraint">
+       <enum>QLayout::SetDefaultConstraint</enum>
+      </property>
+      <property name="margin">
+       <number>0</number>
+      </property>
+      <item>
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>Warnings:</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QTextEdit" name="mWarningTextEdit">
+        <property name="maximumSize">
+         <size>
+          <width>16777215</width>
+          <height>107</height>
+         </size>
+        </property>
+        <property name="autoFormatting">
+         <set>QTextEdit::AutoBulletList</set>
+        </property>
+        <property name="readOnly">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: trunk/src/VBox/Frontends/VirtualBox/ui/VBoxExportApplianceWzd.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/ui/VBoxExportApplianceWzd.ui	(revision 18377)
+++ trunk/src/VBox/Frontends/VirtualBox/ui/VBoxExportApplianceWzd.ui	(revision 18378)
@@ -2,5 +2,5 @@
 <ui version="4.0">
  <comment>
- VBox frontends: Qt4 GUI ("VirtualBox"):
+ VBox frontends: Qt4 GUI (&quot;VirtualBox&quot;):
 
  Copyright (C) 2009 Sun Microsystems, Inc.
@@ -10,5 +10,5 @@
  you can redistribute it and/or modify it under the terms of the GNU
  General Public License (GPL) as published by the Free Software
- Foundation, in version 2 as it comes in the "COPYING" file of the
+ Foundation, in version 2 as it comes in the &quot;COPYING&quot; file of the
  VirtualBox OSE distribution. VirtualBox OSE is distributed in the
  hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
@@ -38,5 +38,5 @@
     <widget class="QStackedWidget" name="mPageStack">
      <property name="currentIndex">
-      <number>0</number>
+      <number>1</number>
      </property>
      <widget class="QWidget" name="mVMSelectPage">
@@ -187,6 +187,6 @@
       </layout>
      </widget>
-     <widget class="QWidget" name="mFileSelectPage">
-      <layout class="QVBoxLayout" name="verticalLayout_3">
+     <widget class="QWidget" name="mVMSettingsPage">
+      <layout class="QVBoxLayout" name="verticalLayout_4">
        <item>
         <widget class="QLabel" name="mPageSettingsHdr">
@@ -205,4 +205,171 @@
        </item>
        <item>
+        <widget class="Line" name="line21_2">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QGridLayout" name="gridLayout_3">
+         <item row="0" column="0" rowspan="2">
+          <widget class="QLabel" name="mLogoSettings">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Maximum" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="autoFillBackground">
+            <bool>true</bool>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+           <property name="pixmap">
+            <pixmap resource="../VirtualBox.qrc">:/vmw_ovf_import.png</pixmap>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="QILabel" name="mTextSettings">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>300</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="text">
+            <string>Here you can change additional configuration values of the selected Virtual Machines. You can modify most of the shown properties by double clicking on the items.</string>
+           </property>
+           <property name="wordWrap">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="VBoxExportApplianceWgt" name="mExportSettingsWgt" native="true">
+           <property name="enabled">
+            <bool>true</bool>
+           </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>0</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="baseSize">
+            <size>
+             <width>0</width>
+             <height>0</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="Line" name="line22_2">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="_4">
+         <item>
+          <widget class="QPushButton" name="mBtnRestore">
+           <property name="text">
+            <string>Restore Defaults</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer>
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>0</width>
+             <height>0</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="mBtnBack2">
+           <property name="text">
+            <string>&lt; &amp;Back</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="mBtnNext2">
+           <property name="text">
+            <string>&amp;Next &gt;</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer>
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeType">
+            <enum>QSizePolicy::Fixed</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>5</width>
+             <height>0</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="mBtnCancel2">
+           <property name="text">
+            <string>Cancel</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="mFileSelectPage">
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <widget class="QLabel" name="mPageFileSelectHdr">
+         <property name="font">
+          <font>
+           <family>Arial</family>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="text">
+          <string>Appliance Export Settings</string>
+         </property>
+        </widget>
+       </item>
+       <item>
         <widget class="Line" name="line21">
          <property name="orientation">
@@ -214,5 +381,5 @@
         <layout class="QGridLayout" name="gridLayout_2">
          <item row="0" column="0" rowspan="3">
-          <widget class="QLabel" name="mLogoSettings">
+          <widget class="QLabel" name="mLogoFileSelect">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Maximum" vsizetype="Minimum">
@@ -236,5 +403,5 @@
          </item>
          <item row="0" column="1">
-          <widget class="QILabel" name="mTextSettings">
+          <widget class="QILabel" name="mTextFileSelect">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@@ -298,5 +465,5 @@
          </item>
          <item>
-          <widget class="QPushButton" name="mBtnBack2">
+          <widget class="QPushButton" name="mBtnBack3">
            <property name="text">
             <string>&lt; &amp;Back</string>
@@ -328,5 +495,5 @@
          </item>
          <item>
-          <widget class="QPushButton" name="mBtnCancel2">
+          <widget class="QPushButton" name="mBtnCancel3">
            <property name="text">
             <string>Cancel</string>
@@ -353,4 +520,10 @@
    <header>VBoxFilePathSelectorWidget.h</header>
   </customwidget>
+  <customwidget>
+   <class>VBoxExportApplianceWgt</class>
+   <extends>QWidget</extends>
+   <header>VBoxExportApplianceWgt.h</header>
+   <container>1</container>
+  </customwidget>
  </customwidgets>
  <resources>
Index: trunk/src/VBox/Frontends/VirtualBox/ui/VBoxImportApplianceWgt.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/ui/VBoxImportApplianceWgt.ui	(revision 18377)
+++ 	(revision )
@@ -1,89 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <comment>
- VBox frontends: Qt4 GUI (&quot;VirtualBox&quot;):
-
- Copyright (C) 2009 Sun Microsystems, Inc.
-
- This file is part of VirtualBox Open Source Edition (OSE), as
- available from http://www.virtualbox.org. This file is free software;
- you can redistribute it and/or modify it under the terms of the GNU
- General Public License (GPL) as published by the Free Software
- Foundation, in version 2 as it comes in the "COPYING" file of the
- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
-
- Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- Clara, CA 95054 USA or visit http://www.sun.com if you need
- additional information or have any questions.
- </comment>
- <class>VBoxImportApplianceWgt</class>
- <widget class="QWidget" name="VBoxImportApplianceWgt">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>459</width>
-    <height>305</height>
-   </rect>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout_2">
-   <property name="margin">
-    <number>0</number>
-   </property>
-   <item>
-    <widget class="QTreeView" name="mTvSettings">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QWidget" name="mWarningWidget" native="true">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <property name="sizeConstraint">
-       <enum>QLayout::SetDefaultConstraint</enum>
-      </property>
-      <property name="margin">
-       <number>0</number>
-      </property>
-      <item>
-       <widget class="QLabel" name="label">
-        <property name="text">
-         <string>Warnings:</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QTextEdit" name="mWarningTextEdit">
-        <property name="maximumSize">
-         <size>
-          <width>16777215</width>
-          <height>107</height>
-         </size>
-        </property>
-        <property name="autoFormatting">
-         <set>QTextEdit::AutoBulletList</set>
-        </property>
-        <property name="readOnly">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
Index: trunk/src/VBox/Frontends/VirtualBox/ui/VBoxImportApplianceWzd.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/ui/VBoxImportApplianceWzd.ui	(revision 18377)
+++ trunk/src/VBox/Frontends/VirtualBox/ui/VBoxImportApplianceWzd.ui	(revision 18378)
@@ -2,5 +2,5 @@
 <ui version="4.0">
  <comment>
- VBox frontends: Qt4 GUI ("VirtualBox"):
+ VBox frontends: Qt4 GUI (&quot;VirtualBox&quot;):
 
  Copyright (C) 2009 Sun Microsystems, Inc.
@@ -10,5 +10,5 @@
  you can redistribute it and/or modify it under the terms of the GNU
  General Public License (GPL) as published by the Free Software
- Foundation, in version 2 as it comes in the "COPYING" file of the
+ Foundation, in version 2 as it comes in the &quot;COPYING&quot; file of the
  VirtualBox OSE distribution. VirtualBox OSE is distributed in the
  hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
@@ -38,5 +38,5 @@
     <widget class="QStackedWidget" name="mPageStack">
      <property name="currentIndex">
-      <number>0</number>
+      <number>1</number>
      </property>
      <widget class="QWidget" name="mFileSelectPage">
@@ -378,13 +378,13 @@
   </customwidget>
   <customwidget>
+   <class>VBoxFilePathSelectorWidget</class>
+   <extends>QComboBox</extends>
+   <header>VBoxFilePathSelectorWidget.h</header>
+  </customwidget>
+  <customwidget>
    <class>VBoxImportApplianceWgt</class>
    <extends>QWidget</extends>
    <header>VBoxImportApplianceWgt.h</header>
    <container>1</container>
-  </customwidget>
-  <customwidget>
-   <class>VBoxFilePathSelectorWidget</class>
-   <extends>QComboBox</extends>
-   <header>VBoxFilePathSelectorWidget.h</header>
   </customwidget>
  </customwidgets>
