Index: /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 54732)
+++ /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 54733)
@@ -299,4 +299,5 @@
 	src/medium/UIMediumManager.h \
 	src/runtime/UIActionPoolRuntime.h \
+	src/runtime/UIAddDiskEncryptionPasswordDialog.h \
 	src/runtime/UIConsoleEventHandler.h \
 	src/runtime/UIFrameBuffer.h \
@@ -491,8 +492,8 @@
 	src/medium/UIMediumManager.cpp \
 	src/runtime/UIActionPoolRuntime.cpp \
+	src/runtime/UIAddDiskEncryptionPasswordDialog.cpp \
 	src/runtime/UIFrameBuffer.cpp \
 	src/runtime/UIIndicatorsPool.cpp \
 	src/runtime/UIStatusBarEditorWindow.cpp \
-    src/runtime/UISession.cpp \
 	src/selector/UIActionPoolSelector.cpp \
 	src/selector/UIVMDesktop.cpp \
@@ -579,4 +580,5 @@
 	src/medium/UIMediumManager.cpp \
 	src/runtime/UIActionPoolRuntime.cpp \
+	src/runtime/UIAddDiskEncryptionPasswordDialog.cpp \
 	src/runtime/UIConsoleEventHandler.cpp \
 	src/runtime/UIFrameBuffer.cpp \
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp	(revision 54733)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp	(revision 54733)
@@ -0,0 +1,453 @@
+/* $Id$ */
+/** @file
+ * VBox Qt GUI - UIAddDiskEncryptionPasswordDialog class implementation.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * 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.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QVBoxLayout>
+# include <QLineEdit>
+# include <QTableView>
+# include <QHeaderView>
+# include <QItemEditorFactory>
+# include <QAbstractTableModel>
+# include <QStandardItemEditorCreator>
+
+/* GUI includes: */
+# include "QILabel.h"
+# include "QIDialogButtonBox.h"
+# include "QIWithRetranslateUI.h"
+# include "QIStyledItemDelegate.h"
+# include "UIAddDiskEncryptionPasswordDialog.h"
+
+/* Other VBox includes: */
+# include <iprt/assert.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/** UIEncryptionDataTable field indexes. */
+enum UIEncryptionDataTableSection
+{
+    UIEncryptionDataTableSection_Id,
+    UIEncryptionDataTableSection_Password,
+    UIEncryptionDataTableSection_Max
+};
+
+/** QLineEdit reimplementation used as
+  * the embedded password editor for the UIEncryptionDataTable. */
+class UIPasswordEditor : public QLineEdit
+{
+    Q_OBJECT;
+
+    /** Holds the current password of the editor. */
+    Q_PROPERTY(QString password READ password WRITE setPassword USER true);
+
+signals:
+
+    /** Notifies listeners about data should be committed. */
+    void sigCommitData(QWidget *pThis);
+
+public:
+
+    /** Constructor.
+      * @param pParent being passed to the base-class. */
+    UIPasswordEditor(QWidget *pParent);
+
+private slots:
+
+    /** Handles @s strPassword changes. */
+    void sltPasswordChanged(const QString &strPassword);
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+
+    /** Property: Returns the current password of the editor. */
+    QString password() const { return QLineEdit::text(); }
+    /** Property: Defines the current @a strPassword of the editor. */
+    void setPassword(const QString &strPassword) { QLineEdit::setText(strPassword); }
+};
+
+/** QAbstractTableModel reimplementation used as
+  * the data representation model for the UIEncryptionDataTable. */
+class UIEncryptionDataModel : public QAbstractTableModel
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor.
+      * @param pParent          being passed to the base-class,
+      * @param encryptedMediums contains the lists of medium ids (values) encrypted with passwords with ids (keys). */
+    UIEncryptionDataModel(QObject *pParent, const EncryptedMediumsMap &encryptedMediums);
+
+    /** Returns the shallow copy of the encryption password map instance. */
+    EncryptionPasswordsMap encryptionPasswords() const { return m_encryptionPasswords; }
+
+    /** Returns the row count, taking optional @a parent instead of root if necessary. */
+    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+    /** Returns the column count, taking optional @a parent instead of root if necessary. */
+    virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+
+    /** Returns the @a index flags. */
+    virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+
+    /** Returns the header data for the @a iSection, @a orientation and @a iRole. */
+    virtual QVariant headerData(int iSection, Qt::Orientation orientation, int iRole) const;
+
+    /** Returns the @a index data for the @a iRole. */
+    virtual QVariant data(const QModelIndex &index, int iRole = Qt::DisplayRole) const;
+    /** Defines the @a index data for the @a iRole as @a value. */
+    virtual bool setData(const QModelIndex &index, const QVariant &value, int iRole = Qt::EditRole);
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+
+    /** Holds the encrypted medium map reference. */
+    const EncryptedMediumsMap &m_encryptedMediums;
+
+    /** Holds the encryption password map instance. */
+    EncryptionPasswordsMap m_encryptionPasswords;
+};
+
+/** QTableView reimplementation used to
+  * allow the UIAddDiskEncryptionPasswordDialog to enter
+  * disk encryption passwords for particular password ids. */
+class UIEncryptionDataTable : public QTableView
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor.
+      * @param pParent being passed to the base-class. */
+    UIEncryptionDataTable(const EncryptedMediumsMap &encryptedMediums);
+
+    /** Returns the shallow copy of the encryption password map
+      * acquired from the UIEncryptionDataModel instance. */
+    EncryptionPasswordsMap encryptionPasswords() const;
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+
+    /** Holds the encrypted medium map reference. */
+    const EncryptedMediumsMap &m_encryptedMediums;
+
+    /** Holds the encryption-data model instance. */
+    UIEncryptionDataModel *m_pModelEncryptionData;
+};
+
+UIPasswordEditor::UIPasswordEditor(QWidget *pParent)
+    : QLineEdit(pParent)
+{
+    /* Prepare: */
+    prepare();
+}
+
+void UIPasswordEditor::sltPasswordChanged(const QString &strPassword)
+{
+    Q_UNUSED(strPassword);
+    /* Commit data to the listener: */
+    emit sigCommitData(this);
+}
+
+void UIPasswordEditor::prepare()
+{
+    /* Set alignment: */
+    setAlignment(Qt::AlignCenter);
+    /* Set echo mode: */
+    setEchoMode(QLineEdit::Password);
+    /* Listen for the text changes: */
+    connect(this, SIGNAL(textChanged(const QString&)),
+            this, SLOT(sltPasswordChanged(const QString&)));
+}
+
+UIEncryptionDataModel::UIEncryptionDataModel(QObject *pParent, const EncryptedMediumsMap &encryptedMediums)
+    : QAbstractTableModel(pParent)
+    , m_encryptedMediums(encryptedMediums)
+{
+    /* Prepare: */
+    prepare();
+}
+
+int UIEncryptionDataModel::rowCount(const QModelIndex &parent /* = QModelIndex() */) const
+{
+    Q_UNUSED(parent);
+    return m_encryptionPasswords.size();
+}
+
+int UIEncryptionDataModel::columnCount(const QModelIndex &parent /* = QModelIndex() */) const
+{
+    Q_UNUSED(parent);
+    return UIEncryptionDataTableSection_Max;
+}
+
+Qt::ItemFlags UIEncryptionDataModel::flags(const QModelIndex &index) const
+{
+    /* Check index validness: */
+    if (!index.isValid())
+        return Qt::NoItemFlags;
+    /* Depending on column index: */
+    switch (index.column())
+    {
+        case UIEncryptionDataTableSection_Id:       return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+        case UIEncryptionDataTableSection_Password: return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
+        default: break;
+    }
+    /* No flags by default: */
+    return Qt::NoItemFlags;
+}
+
+QVariant UIEncryptionDataModel::headerData(int iSection, Qt::Orientation orientation, int iRole) const
+{
+    /* Check argument validness: */
+    if (iRole != Qt::DisplayRole || orientation != Qt::Horizontal)
+        return QVariant();
+    /* Depending on column index: */
+    switch (iSection)
+    {
+        case UIEncryptionDataTableSection_Id:       return tr("Password ID");
+        case UIEncryptionDataTableSection_Password: return tr("Password");
+        default: break;
+    }
+    /* Null value by default: */
+    return QVariant();
+}
+
+QVariant UIEncryptionDataModel::data(const QModelIndex &index, int iRole /* = Qt::DisplayRole */) const
+{
+    /* Check index validness: */
+    if (!index.isValid())
+        return QVariant();
+    /* Depending on role: */
+    switch (iRole)
+    {
+        case Qt::DisplayRole:
+        {
+            /* Depending on column index: */
+            switch (index.column())
+            {
+                case UIEncryptionDataTableSection_Id:
+                    return m_encryptionPasswords.keys().at(index.row());
+                case UIEncryptionDataTableSection_Password:
+                    return QString().fill('*', m_encryptionPasswords.value(m_encryptionPasswords.keys().at(index.row())).size());
+                default:
+                    return QVariant();
+            }
+            break;
+        }
+        case Qt::EditRole:
+        {
+            /* Depending on column index: */
+            switch (index.column())
+            {
+                case UIEncryptionDataTableSection_Password:
+                    return m_encryptionPasswords.value(m_encryptionPasswords.keys().at(index.row()));
+                default:
+                    return QVariant();
+            }
+            break;
+        }
+        case Qt::TextAlignmentRole:
+        {
+            /* Depending on column index: */
+            switch (index.column())
+            {
+                case UIEncryptionDataTableSection_Password:
+                    return Qt::AlignCenter;
+                default: return QVariant();
+            }
+            break;
+        }
+        default:
+            break;
+    }
+    /* Null value by default: */
+    return QVariant();
+}
+
+bool UIEncryptionDataModel::setData(const QModelIndex &index, const QVariant &value, int iRole /* = Qt::EditRole */)
+{
+    /* Check index validness: */
+    if (!index.isValid())
+        return false;
+    /* Check argument validness: */
+    if (iRole != Qt::EditRole)
+        return false;
+    /* Depending on column index: */
+    switch (index.column())
+    {
+        case UIEncryptionDataTableSection_Password: m_encryptionPasswords[m_encryptionPasswords.keys().at(index.row())] = value.toString(); break;
+        default: break;
+    }
+    /* Nothing to set by default: */
+    return false;
+}
+
+void UIEncryptionDataModel::prepare()
+{
+    /* Populate the map of passwords. */
+    foreach (const QString &strPasswordId, m_encryptedMediums.keys())
+        m_encryptionPasswords.insert(strPasswordId, QString());
+}
+
+UIEncryptionDataTable::UIEncryptionDataTable(const EncryptedMediumsMap &encryptedMediums)
+    : m_encryptedMediums(encryptedMediums)
+    , m_pModelEncryptionData(0)
+{
+    /* Prepare: */
+    prepare();
+}
+
+EncryptionPasswordsMap UIEncryptionDataTable::encryptionPasswords() const
+{
+    AssertPtrReturn(m_pModelEncryptionData, EncryptionPasswordsMap());
+    return m_pModelEncryptionData->encryptionPasswords();
+}
+
+void UIEncryptionDataTable::prepare()
+{
+    /* Create encryption-data model: */
+    m_pModelEncryptionData = new UIEncryptionDataModel(this, m_encryptedMediums);
+    AssertPtrReturnVoid(m_pModelEncryptionData);
+    {
+        /* Assign configured model to table: */
+        setModel(m_pModelEncryptionData);
+    }
+
+    /* Create item delegate: */
+    QIStyledItemDelegate *pStyledItemDelegate = new QIStyledItemDelegate(this);
+    AssertPtrReturnVoid(pStyledItemDelegate);
+    {
+        /* Create item editor factory: */
+        QItemEditorFactory *pNewItemEditorFactory = new QItemEditorFactory;
+        AssertPtrReturnVoid(pNewItemEditorFactory);
+        {
+            /* Create item editor creator: */
+            QStandardItemEditorCreator<UIPasswordEditor> *pQStringItemEditorCreator = new QStandardItemEditorCreator<UIPasswordEditor>();
+            AssertPtrReturnVoid(pQStringItemEditorCreator);
+            {
+                /* Register UIPasswordEditor as the QString editor: */
+                pNewItemEditorFactory->registerEditor(QVariant::String, pQStringItemEditorCreator);
+            }
+            /* Assign configured item editor factory to table delegate: */
+            pStyledItemDelegate->setItemEditorFactory(pNewItemEditorFactory);
+        }
+        /* Assign configured item delegate to table: */
+        delete itemDelegate();
+        setItemDelegate(pStyledItemDelegate);
+    }
+
+    /* Configure table: */
+    setTabKeyNavigation(false);
+    setContextMenuPolicy(Qt::CustomContextMenu);
+    setSelectionBehavior(QAbstractItemView::SelectRows);
+    setSelectionMode(QAbstractItemView::SingleSelection);
+    setEditTriggers(QAbstractItemView::CurrentChanged | QAbstractItemView::SelectedClicked);
+
+    /* Configure headers: */
+    verticalHeader()->hide();
+    verticalHeader()->setDefaultSectionSize((int)(verticalHeader()->minimumSectionSize() * 1.33));
+    horizontalHeader()->setStretchLastSection(false);
+    horizontalHeader()->setResizeMode(UIEncryptionDataTableSection_Id, QHeaderView::Interactive);
+    horizontalHeader()->setResizeMode(UIEncryptionDataTableSection_Password, QHeaderView::Stretch);
+}
+
+UIAddDiskEncryptionPasswordDialog::UIAddDiskEncryptionPasswordDialog(QWidget *pParent, const EncryptedMediumsMap &encryptedMediums)
+    : QIWithRetranslateUI<QDialog>(pParent)
+    , m_encryptedMediums(encryptedMediums)
+    , m_pLabelDescription(0)
+    , m_pTableEncryptionData(0)
+{
+    /* Prepare: */
+    prepare();
+    /* Retranslate: */
+    retranslateUi();
+}
+
+EncryptionPasswordsMap UIAddDiskEncryptionPasswordDialog::encryptionPasswords() const
+{
+    AssertPtrReturn(m_pTableEncryptionData, EncryptionPasswordsMap());
+    return m_pTableEncryptionData->encryptionPasswords();
+}
+
+void UIAddDiskEncryptionPasswordDialog::prepare()
+{
+    /* Create main-layout: */
+    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
+    AssertPtrReturnVoid(pMainLayout);
+    {
+        /* Create input-layout: */
+        QVBoxLayout *pInputLayout = new QVBoxLayout;
+        AssertPtrReturnVoid(pInputLayout);
+        {
+            /* Create description label: */
+            m_pLabelDescription = new QILabel;
+            m_pLabelDescription->useSizeHintForWidth(450);
+            m_pLabelDescription->updateGeometry();
+            AssertPtrReturnVoid(m_pLabelDescription);
+            {
+                /* Configure description label: */
+                m_pLabelDescription->setWordWrap(true);
+                /* Add label into layout: */
+                pInputLayout->addWidget(m_pLabelDescription);
+            }
+            /* Create encryption-data table: */
+            m_pTableEncryptionData = new UIEncryptionDataTable(m_encryptedMediums);
+            AssertPtrReturnVoid(m_pTableEncryptionData);
+            {
+                /* Add label into layout: */
+                pInputLayout->addWidget(m_pTableEncryptionData);
+            }
+            /* Add layout into parent: */
+            pMainLayout->addLayout(pInputLayout);
+        }
+        /* Create button-box: */
+        QIDialogButtonBox *pButtonBox = new QIDialogButtonBox;
+        AssertPtrReturnVoid(pButtonBox);
+        {
+            /* Configure button-box: */
+            pButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+            connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
+            connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
+            /* Add button-box into layout: */
+            pMainLayout->addWidget(pButtonBox);
+        }
+    }
+}
+
+void UIAddDiskEncryptionPasswordDialog::retranslateUi()
+{
+    AssertPtrReturnVoid(m_pLabelDescription);
+    m_pLabelDescription->setText(tr("This virtual machine is password protected. "
+                                    "Please enter the %n encryption password(s) below.",
+                                    "This text is never used with n == 0. "
+                                    "Feel free to drop the %n where possible, "
+                                    "we only included it because of problems with Qt Linguist "
+                                    "(but the user can see how many passwords are in the list "
+                                    "and doesn't need to be told).",
+                                    m_encryptedMediums.size()));
+}
+
+#include "UIAddDiskEncryptionPasswordDialog.moc"
+
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.h	(revision 54733)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.h	(revision 54733)
@@ -0,0 +1,70 @@
+/** @file
+ * VBox Qt GUI - UIAddDiskEncryptionPasswordDialog class declaration.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * 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.
+ */
+
+#ifndef ___UIAddDiskEncryptionPasswordDialog_h___
+#define ___UIAddDiskEncryptionPasswordDialog_h___
+
+/* Qt includes: */
+#include <QDialog>
+#include <QMultiMap>
+#include <QMap>
+
+/* GUI includes: */
+#include "QIWithRetranslateUI.h"
+
+/* Forward declarations: */
+class UIEncryptionDataTable;
+class QILabel;
+
+/* Type definitions: */
+typedef QMultiMap<QString, QString> EncryptedMediumsMap;
+typedef QMap<QString, QString> EncryptionPasswordsMap;
+
+/** QDialog reimplementation used to
+  * allow the user to enter disk encryption passwords for particular password ids. */
+class UIAddDiskEncryptionPasswordDialog : public QIWithRetranslateUI<QDialog>
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor.
+      * @param pParent          being passed to the base-class,
+      * @param encryptedMediums contains the lists of medium ids (values) encrypted with passwords with ids (keys). */
+    UIAddDiskEncryptionPasswordDialog(QWidget *pParent, const EncryptedMediumsMap &encryptedMediums);
+
+    /** Returns the shallow copy of the encryption password map
+      * acquired from the UIEncryptionDataTable instance. */
+    EncryptionPasswordsMap encryptionPasswords() const;
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+
+    /** Translation routine. */
+    void retranslateUi();
+
+    /** Holds the encrypted medium map reference. */
+    const EncryptedMediumsMap &m_encryptedMediums;
+
+    /** Holds the description label instance. */
+    QILabel *m_pLabelDescription;
+    /** Holds the encryption-data table instance. */
+    UIEncryptionDataTable *m_pTableEncryptionData;
+};
+
+#endif /* !___UIAddDiskEncryptionPasswordDialog_h___ */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 54732)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 54733)
@@ -44,4 +44,5 @@
 # include "UIFrameBuffer.h"
 # include "UISettingsDialogSpecific.h"
+# include "UIAddDiskEncryptionPasswordDialog.h"
 # ifdef VBOX_WITH_VIDEOHWACCEL
 #  include "VBoxFBOverlay.h"
@@ -80,434 +81,4 @@
 # endif /* VBOX_WITHOUT_XCURSOR */
 #endif /* Q_WS_X11 */
-
-
-/* Qt includes: */
-#include <QDialog>
-#include <QVBoxLayout>
-#include <QLineEdit>
-#include <QTableView>
-#include <QHeaderView>
-#include <QItemEditorFactory>
-#include <QAbstractTableModel>
-#include <QStandardItemEditorCreator>
-/* GUI includes: */
-#include "QILabel.h"
-#include "QIDialogButtonBox.h"
-#include "QIWithRetranslateUI.h"
-#include "QIStyledItemDelegate.h"
-
-/* Type definitions: */
-typedef QMap<QString, QString> EncryptionPasswordsMap;
-typedef QMultiMap<QString, QString> EncryptedMediumsMap;
-
-/** Encryption-data table field indexes.
-  * @todo To be moved into separate file.. */
-enum UIEncryptionTableSection
-{
-    UIEncryptionTableSection_Id,
-    UIEncryptionTableSection_Password,
-    UIEncryptionTableSection_Max
-};
-
-/** QLineEdit implementation allowing to enter
-  * disk encryption password for particular password id.
-  * @todo To be moved into separate file.. */
-class UILineEdit : public QLineEdit
-{
-    Q_OBJECT;
-    Q_PROPERTY(QString password READ password WRITE setPassword USER true);
-
-signals:
-
-    /** Notifies listener about data should be committed. */
-    void sigCommitData(QWidget *pThis);
-
-public:
-
-    /** Constructor.
-      * @param pParent being passed to the base-class. */
-    UILineEdit(QWidget *pParent)
-        : QLineEdit(pParent)
-    {
-        /* Prepare: */
-        prepare();
-    }
-
-public slots:
-
-    /** Handles @s strText changes. */
-    void sltTextChanged(const QString &strText)
-    {
-        Q_UNUSED(strText);
-        /* Commit data to the listener: */
-        emit sigCommitData(this);
-    }
-
-private:
-
-    /** Prepare routine. */
-    void prepare()
-    {
-        /* Set alignment: */
-        setAlignment(Qt::AlignCenter);
-        /* Set echo mode: */
-        setEchoMode(QLineEdit::Password);
-        /* Listen for the text changes: */
-        connect(this, SIGNAL(textChanged(const QString&)),
-                this, SLOT(sltTextChanged(const QString&)));
-    }
-
-    /** Returns the password from the editor. */
-    QString password() const { return QLineEdit::text(); }
-    /** Defines the @a strPassword to the editor. */
-    void setPassword(const QString &strPassword) { QLineEdit::setText(strPassword); }
-};
-
-/** QAbstractTableModel implementation reflecting
-  * disk encryption passwords for particular password ids.
-  * @todo To be moved into separate file.. */
-class UIEncryptionDataModel : public QAbstractTableModel
-{
-    Q_OBJECT;
-
-public:
-
-    /** Constructor.
-      * @param pParent          being passed to the base-class,
-      * @param encryptedMediums contains the lists of medium ids (values) encrypted with passwords with ids (keys). */
-    UIEncryptionDataModel(QObject *pParent, const EncryptedMediumsMap &encryptedMediums)
-        : QAbstractTableModel(pParent)
-        , m_encryptedMediums(encryptedMediums)
-    {
-        /* Prepare: */
-        prepare();
-    }
-
-    /** Returns encryption passwords. */
-    EncryptionPasswordsMap encryptionPasswords() const { return m_encryptionPasswords; }
-
-    /** Returns the @a index flags. */
-    virtual Qt::ItemFlags flags(const QModelIndex &index) const
-    {
-        /* Check index validness: */
-        if (!index.isValid())
-            return Qt::NoItemFlags;
-        /* Depending on column index: */
-        switch (index.column())
-        {
-            case UIEncryptionTableSection_Id:       return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
-            case UIEncryptionTableSection_Password: return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
-            default: break;
-        }
-        /* No flags by default: */
-        return Qt::NoItemFlags;
-    }
-
-    /** Returns the row count. Provide optional @a parent instead of root if necessary. */
-    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const
-    {
-        Q_UNUSED(parent);
-        return m_encryptionPasswords.size();
-    }
-
-    /** Returns the column count. Provide optional @a parent instead of root if necessary. */
-    virtual int columnCount(const QModelIndex &parent = QModelIndex()) const
-    {
-        Q_UNUSED(parent);
-        return UIEncryptionTableSection_Max;
-    }
-
-    /** Returns header data for @a iSection, @a orientation and @a iRole. */
-    virtual QVariant headerData(int iSection, Qt::Orientation orientation, int iRole) const
-    {
-        /* Check argument validness: */
-        if (iRole != Qt::DisplayRole || orientation != Qt::Horizontal)
-            return QVariant();
-        /* Depending on column index: */
-        switch (iSection)
-        {
-            case UIEncryptionTableSection_Id:       return tr("Password ID");
-            case UIEncryptionTableSection_Password: return tr("Password");
-            default: break;
-        }
-        /* Null value by default: */
-        return QVariant();
-    }
-
-    /** Returns @a index data for @a iRole. */
-    virtual QVariant data(const QModelIndex &index, int iRole /* = Qt::DisplayRole */) const
-    {
-        /* Check index validness: */
-        if (!index.isValid())
-            return QVariant();
-        /* Depending on role: */
-        switch (iRole)
-        {
-            case Qt::DisplayRole:
-            {
-                /* Depending on column index: */
-                switch (index.column())
-                {
-                    case UIEncryptionTableSection_Id:
-                        return m_encryptionPasswords.keys().at(index.row());
-                    case UIEncryptionTableSection_Password:
-                        return QString().fill('*', m_encryptionPasswords.value(m_encryptionPasswords.keys().at(index.row())).size());
-                    default:
-                        return QVariant();
-                }
-                break;
-            }
-            case Qt::EditRole:
-            {
-                /* Depending on column index: */
-                switch (index.column())
-                {
-                    case UIEncryptionTableSection_Password:
-                        return m_encryptionPasswords.value(m_encryptionPasswords.keys().at(index.row()));
-                    default:
-                        return QVariant();
-                }
-                break;
-            }
-            case Qt::TextAlignmentRole:
-            {
-                /* Depending on column index: */
-                switch (index.column())
-                {
-                    case UIEncryptionTableSection_Password:
-                        return Qt::AlignCenter;
-                    default: return QVariant();
-                }
-                break;
-            }
-            default:
-                break;
-        }
-        /* Null value by default: */
-        return QVariant();
-    }
-
-    /** Defines @a index data for @a iRole as @a value. */
-    virtual bool setData(const QModelIndex &index, const QVariant &value, int iRole /* = Qt::EditRole */)
-    {
-        /* Check index validness: */
-        if (!index.isValid())
-            return false;
-        /* Check argument validness: */
-        if (iRole != Qt::EditRole)
-            return false;
-        /* Depending on column index: */
-        switch (index.column())
-        {
-            case UIEncryptionTableSection_Password: m_encryptionPasswords[m_encryptionPasswords.keys().at(index.row())] = value.toString(); break;
-            default: break;
-        }
-        /* Nothing to set by default: */
-        return false;
-    }
-
-private:
-
-    /** Prepare routine. */
-    void prepare()
-    {
-        /* Populate the map of passwords. */
-        foreach (const QString &strPasswordId, m_encryptedMediums.keys())
-            m_encryptionPasswords.insert(strPasswordId, QString());
-    }
-
-    /** Holds the encrypted medium map reference. */
-    const EncryptedMediumsMap &m_encryptedMediums;
-
-    /** Holds the encrypted password id map. */
-    EncryptionPasswordsMap m_encryptionPasswords;
-};
-
-/** QTableView implementation allowing to enter
-  * disk encryption passwords for particular password ids.
-  * @todo To be moved into separate file.. */
-class UIEncryptionDataTable : public QTableView
-{
-    Q_OBJECT;
-
-public:
-
-    /** Constructor.
-      * @param pParent being passed to the base-class. */
-    UIEncryptionDataTable(const EncryptedMediumsMap &encryptedMediums)
-        : m_encryptedMediums(encryptedMediums)
-        , m_pModelEncryptionData(0)
-    {
-        /* Prepare: */
-        prepare();
-    }
-
-    /** Returns encryption passwords. */
-    EncryptionPasswordsMap encryptionPasswords() const
-    {
-        AssertPtrReturn(m_pModelEncryptionData, EncryptionPasswordsMap());
-        return m_pModelEncryptionData->encryptionPasswords();
-    }
-
-private:
-
-    /** Prepare routine. */
-    void prepare()
-    {
-        /* Create encryption-data model: */
-        m_pModelEncryptionData = new UIEncryptionDataModel(this, m_encryptedMediums);
-        AssertPtrReturnVoid(m_pModelEncryptionData);
-        {
-            /* Assign configured model to table: */
-            setModel(m_pModelEncryptionData);
-        }
-
-        /* Create item delegate: */
-        QIStyledItemDelegate *pStyledItemDelegate = new QIStyledItemDelegate(this);
-        AssertPtrReturnVoid(pStyledItemDelegate);
-        {
-            /* Create item editor factory: */
-            QItemEditorFactory *pNewItemEditorFactory = new QItemEditorFactory;
-            AssertPtrReturnVoid(pNewItemEditorFactory);
-            {
-                /* Create item editor creator: */
-                QStandardItemEditorCreator<UILineEdit> *pQStringItemEditorCreator = new QStandardItemEditorCreator<UILineEdit>();
-                AssertPtrReturnVoid(pQStringItemEditorCreator);
-                {
-                    /* Register UILineEdit as the QString editor: */
-                    pNewItemEditorFactory->registerEditor(QVariant::String, pQStringItemEditorCreator);
-                }
-                /* Assign configured item editor factory to table delegate: */
-                pStyledItemDelegate->setItemEditorFactory(pNewItemEditorFactory);
-            }
-            /* Assign configured item delegate to table: */
-            delete itemDelegate();
-            setItemDelegate(pStyledItemDelegate);
-        }
-
-        /* Configure table: */
-        setTabKeyNavigation(false);
-        setContextMenuPolicy(Qt::CustomContextMenu);
-        setSelectionBehavior(QAbstractItemView::SelectRows);
-        setSelectionMode(QAbstractItemView::SingleSelection);
-        setEditTriggers(QAbstractItemView::CurrentChanged | QAbstractItemView::SelectedClicked);
-
-        /* Configure headers: */
-        verticalHeader()->hide();
-        verticalHeader()->setDefaultSectionSize((int)(verticalHeader()->minimumSectionSize() * 1.33));
-        horizontalHeader()->setStretchLastSection(false);
-        horizontalHeader()->setResizeMode(UIEncryptionTableSection_Id, QHeaderView::Interactive);
-        horizontalHeader()->setResizeMode(UIEncryptionTableSection_Password, QHeaderView::Stretch);
-    }
-
-    /** Holds the encrypted medium map reference. */
-    const EncryptedMediumsMap &m_encryptedMediums;
-
-    /** Holds the encryption-data model. */
-    UIEncryptionDataModel *m_pModelEncryptionData;
-};
-
-/** QDialog implementation allowing to enter
-  * disk encryption passwords for particular password ids.
-  * @todo To be moved into separate files.. */
-class UIAddDiskEncryptionPasswordDialog : public QIWithRetranslateUI<QDialog>
-{
-    Q_OBJECT;
-
-public:
-
-    /** Constructor.
-      * @param pParent          being passed to the base-class,
-      * @param encryptedMediums contains the lists of medium ids (values) encrypted with passwords with ids (keys). */
-    UIAddDiskEncryptionPasswordDialog(QWidget *pParent, const EncryptedMediumsMap &encryptedMediums)
-        : QIWithRetranslateUI<QDialog>(pParent)
-        , m_encryptedMediums(encryptedMediums)
-        , m_pLabelDescription(0)
-        , m_pTableEncryptionData(0)
-    {
-        /* Prepare: */
-        prepare();
-        /* Retranslate: */
-        retranslateUi();
-    }
-
-    /** Returns encryption passwords. */
-    EncryptionPasswordsMap encryptionPasswords() const
-    {
-        AssertPtrReturn(m_pTableEncryptionData, EncryptionPasswordsMap());
-        return m_pTableEncryptionData->encryptionPasswords();
-    }
-
-private:
-
-    /** Prepare routine. */
-    void prepare()
-    {
-        /* Create main-layout: */
-        QVBoxLayout *pMainLayout = new QVBoxLayout(this);
-        AssertPtrReturnVoid(pMainLayout);
-        {
-            /* Create input-layout: */
-            QVBoxLayout *pInputLayout = new QVBoxLayout;
-            AssertPtrReturnVoid(pInputLayout);
-            {
-                /* Create description label: */
-                m_pLabelDescription = new QILabel;
-                m_pLabelDescription->useSizeHintForWidth(450);
-                m_pLabelDescription->updateGeometry();
-                AssertPtrReturnVoid(m_pLabelDescription);
-                {
-                    /* Configure description label: */
-                    m_pLabelDescription->setWordWrap(true);
-                    /* Add label into layout: */
-                    pInputLayout->addWidget(m_pLabelDescription);
-                }
-                /* Create encryption-data table: */
-                m_pTableEncryptionData = new UIEncryptionDataTable(m_encryptedMediums);
-                AssertPtrReturnVoid(m_pTableEncryptionData);
-                {
-                    /* Add label into layout: */
-                    pInputLayout->addWidget(m_pTableEncryptionData);
-                }
-                /* Add layout into parent: */
-                pMainLayout->addLayout(pInputLayout);
-            }
-            /* Create button-box: */
-            QIDialogButtonBox *pButtonBox = new QIDialogButtonBox;
-            AssertPtrReturnVoid(pButtonBox);
-            {
-                /* Configure button-box: */
-                pButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
-                connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
-                connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
-                /* Add button-box into layout: */
-                pMainLayout->addWidget(pButtonBox);
-            }
-        }
-    }
-
-    /** Translation routine. */
-    void retranslateUi()
-    {
-        AssertPtrReturnVoid(m_pLabelDescription);
-        m_pLabelDescription->setText(tr("This virtual machine is password protected. "
-                                        "Please enter the %n encryption password(s) below.",
-                                        "This text is never used with n == 0. "
-                                        "Feel free to drop the %n where possible, "
-                                        "we only included it because of problems with Qt Linguist "
-                                        "(but the user can see how many passwords are in the list "
-                                        "and doesn't need to be told).",
-                                        m_encryptedMediums.size()));
-    }
-
-    /** Holds the encrypted medium map reference. */
-    const EncryptedMediumsMap &m_encryptedMediums;
-
-    /** Holds the description label. */
-    QILabel *m_pLabelDescription;
-    /** Holds the encryption-data table. */
-    UIEncryptionDataTable *m_pTableEncryptionData;
-};
-
 
 #ifdef VBOX_GUI_WITH_KEYS_RESET_HANDLER
@@ -2412,4 +1983,2 @@
 #endif /* VBOX_GUI_WITH_KEYS_RESET_HANDLER */
 
-#include "UISession.moc"
-
