Index: /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.cpp	(revision 45307)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.cpp	(revision 45308)
@@ -20,23 +20,18 @@
 /* Qt includes: */
 #include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QClipboard>
 #include <QLabel>
+#include <QTextEdit>
+#include <QCheckBox>
 #include <QPushButton>
-#include <QStyleOptionFocusRect>
-#include <QStylePainter>
-#include <QToolButton>
-#include <QKeyEvent>
-#include <QClipboard>
 
 /* GUI includes: */
+#include "QIMessageBox.h"
+#include "UIIconPool.h"
+#include "QILabel.h"
+#include "QIArrowSplitter.h"
+#include "QIDialogButtonBox.h"
 #include "VBoxGlobal.h"
-#include "QIArrowSplitter.h"
-#include "QIMessageBox.h"
-#include "QILabel.h"
-#include "QIDialogButtonBox.h"
-#include "UIIconPool.h"
-#ifdef Q_WS_MAC
-# include "UIMachineWindowFullscreen.h"
-# include "UIMachineWindowSeamless.h"
-#endif /* Q_WS_MAC */
 
 QIMessageBox::QIMessageBox(const QString &strCaption, const QString &strMessage, AlertIconType iconType,
@@ -62,13 +57,53 @@
 }
 
-/**
- *  Returns the text of the given message box button.
- *  See QMessageBox::buttonText() for details.
- *
- *  @param aButton Button index (0, 1 or 2).
- */
-QString QIMessageBox::buttonText (int aButton) const
-{
-    switch (aButton)
+QString QIMessageBox::detailsText() const
+{
+    /* Return in html format: */
+    return m_pDetailsTextView->toHtml();
+}
+
+void QIMessageBox::setDetailsText(const QString &strText)
+{
+    /* Split details into paragraphs: */
+    AssertMsg(!strText.isEmpty(), ("Details text should NOT be empty!"));
+    QStringList paragraphs(strText.split("<!--EOP-->", QString::SkipEmptyParts));
+    AssertMsg(paragraphs.size() != 0, ("There should be at least one paragraph."));
+    /* Populate details list: */
+    foreach (const QString &strParagraph, paragraphs)
+    {
+        QStringList parts(strParagraph.split("<!--EOM-->", QString::KeepEmptyParts));
+        AssertMsg(parts.size() == 2, ("Each paragraph should consist of 2 parts."));
+        m_details << QPair<QString, QString>(parts[0], parts[1]);
+    }
+    /* Update details container: */
+    updateDetailsContainer();
+}
+
+bool QIMessageBox::flagChecked() const
+{
+    return m_pFlagCheckBox->isChecked();
+}
+
+void QIMessageBox::setFlagChecked(bool fChecked)
+{
+    m_pFlagCheckBox->setChecked(fChecked);
+}
+
+QString QIMessageBox::flagText() const
+{
+    return m_pFlagCheckBox->text();
+}
+
+void QIMessageBox::setFlagText(const QString &strText)
+{
+    /* Set check-box text: */
+    m_pFlagCheckBox->setText(strText);
+    /* And update check-box finally: */
+    updateCheckBox();
+}
+
+QString QIMessageBox::buttonText(int iButton) const
+{
+    switch (iButton)
     {
         case 0: if (m_pButton1) return m_pButton1->text(); break;
@@ -77,51 +112,85 @@
         default: break;
     }
-
-    return QString::null;
-}
-
-/**
- *  Sets the text of the given message box button.
- *  See QMessageBox::setButtonText() for details.
- *
- *  @param aButton  Button index (0, 1 or 2).
- *  @param aText    New button text.
- */
-void QIMessageBox::setButtonText (int aButton, const QString &aText)
-{
-    switch (aButton)
-    {
-        case 0: if (m_pButton1) m_pButton1->setText (aText); break;
-        case 1: if (m_pButton2) m_pButton2->setText (aText); break;
-        case 2: if (m_pButton3) m_pButton3->setText (aText); break;
+    return QString();
+}
+
+void QIMessageBox::setButtonText(int iButton, const QString &strText)
+{
+    switch (iButton)
+    {
+        case 0: if (m_pButton1) m_pButton1->setText(strText); break;
+        case 1: if (m_pButton2) m_pButton2->setText(strText); break;
+        case 2: if (m_pButton3) m_pButton3->setText(strText); break;
         default: break;
     }
 }
 
-/** @fn QIMessageBox::flagText() const
- *
- *  Returns the text of the optional message box flag. If the flag is hidden
- *  (by default) a null string is returned.
- *
- *  @see #setFlagText()
- */
-
-/**
- *  Sets the text for the optional message box flag (check box) that is
- *  displayed under the message text. Passing the null string as the argument
- *  will hide the flag. By default, the flag is hidden.
- */
-void QIMessageBox::setFlagText (const QString &aText)
-{
-    if (aText.isNull())
-    {
-        m_pFlagCheckBox->hide();
-    }
-    else
-    {
-        m_pFlagCheckBox->setText (aText);
-        m_pFlagCheckBox->show();
-        m_pFlagCheckBox->setFocus();
-    }
+void QIMessageBox::reject()
+{
+    if (m_iButtonEsc)
+    {
+        QDialog::reject();
+        setResult(m_iButtonEsc & AlertButtonMask);
+    }
+}
+
+void QIMessageBox::copy() const
+{
+    /* Create the error string with all errors. First the html version. */
+    QString strError = "<html><body><p>" + m_strMessage + "</p>";
+    for (int i = 0; i < m_details.size(); ++i)
+        strError += m_details.at(i).first + m_details.at(i).second + "<br>";
+    strError += "</body></html>";
+    strError.remove(QRegExp("</+qt>"));
+    strError = strError.replace(QRegExp("&nbsp;"), " ");
+    /* Create a new mime data object holding both the html and the plain text version. */
+    QMimeData *pMd = new QMimeData();
+    pMd->setHtml(strError);
+    /* Replace all the html entities. */
+    strError = strError.replace(QRegExp("<br>|</tr>"), "\n");
+    strError = strError.replace(QRegExp("</p>"), "\n\n");
+    strError = strError.remove(QRegExp("<[^>]*>"));
+    pMd->setText(strError);
+    /* Add the mime data to the global clipboard. */
+    QClipboard *pClipboard = QApplication::clipboard();
+    pClipboard->setMimeData(pMd);
+}
+
+void QIMessageBox::detailsBack()
+{
+    /* Make sure details-page index feats the bounds: */
+    if (m_iDetailsIndex <= 0)
+        return;
+
+    /* Advance the page index: */
+    --m_iDetailsIndex;
+    /* Update details-page: */
+    updateDetailsPage();
+}
+
+void QIMessageBox::detailsNext()
+{
+    /* Make sure details-page index feats the bounds: */
+    if (m_iDetailsIndex >= m_details.size() - 1)
+        return;
+
+    /* Advance the page index: */
+    ++m_iDetailsIndex;
+    /* Update details-page: */
+    updateDetailsPage();
+}
+
+void QIMessageBox::sltUpdateSize()
+{
+    /* Reactivate all the layouts: */
+    QList<QLayout*> layouts = findChildren<QLayout*>();
+    foreach (QLayout *pLayout, layouts)
+    {
+        pLayout->update();
+        pLayout->activate();
+    }
+    QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
+    /* And fix the size to the minimum possible: */
+    setFixedSize(minimumSizeHint());
 }
 
@@ -138,33 +207,17 @@
             {
                 /* Configure label: */
-                m_pIconLabel->setPixmap(standardPixmap(m_iconType));
+                m_pIconLabel->setPixmap(standardPixmap(m_iconType, this));
+                m_pIconLabel->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
                 m_pIconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
-                m_pIconLabel->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
             }
-            /* Create top-right layout: */
-            QVBoxLayout *pTopRightLayout = new QVBoxLayout;
+            /* Create text-label: */
+            m_pTextLabel = new QILabel(m_strMessage);
             {
-                /* Create text-label: */
-                m_pTextLabel = new QILabel(m_strMessage);
-                {
-                    /* Configure label: */
-                    m_pTextLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
-                    m_pTextLabel->setWordWrap(true);
-                    QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
-                    sizePolicy.setHeightForWidth(true);
-                    m_pTextLabel->setSizePolicy(sizePolicy);
-                }
-                /* Create main check-box: */
-                m_pFlagCheckBox_Main = new QCheckBox;
-                {
-                    /* Configure check-box: */
-                    m_pFlagCheckBox_Main->hide();
-                    m_pFlagCheckBox_Main->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-                }
-                /* Configure layout: */
-                VBoxGlobal::setLayoutMargin(pTopRightLayout, 0);
-                pTopRightLayout->setSpacing(10);
-                pTopRightLayout->addWidget(m_pTextLabel);
-                pTopRightLayout->addWidget(m_pFlagCheckBox_Main);
+                /* Configure label: */
+                m_pTextLabel->setWordWrap(true);
+                m_pTextLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
+                QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+                sizePolicy.setHeightForWidth(true);
+                m_pTextLabel->setSizePolicy(sizePolicy);
             }
             /* Configure layout: */
@@ -172,43 +225,33 @@
             pTopLayout->setSpacing(10);
             pTopLayout->addWidget(m_pIconLabel);
-            pTopLayout->addLayout(pTopRightLayout);
+            pTopLayout->addWidget(m_pTextLabel);
         }
-        /* Create details-widget: */
-        m_pDetailsWidget = new QWidget;
+        /* Create details text-view: */
+        m_pDetailsTextView = new QTextEdit;
         {
-            /* Create details-widget layout: */
-            QVBoxLayout* pDetailsWidgetLayout = new QVBoxLayout(m_pDetailsWidget);
-            {
-                /* Create details text-view: */
-                m_pDetailsTextView = new QTextEdit;
-                {
-                    /* Configure text-view: */
-                    m_pDetailsTextView->setReadOnly(true);
-                    m_pDetailsTextView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
-                    /* Calculate the minimum size dynamically, approx. for 40 chars, 4 lines & 2 <table> margins: */
-                    QFontMetrics fm = m_pDetailsTextView->fontMetrics();
-                    m_pDetailsTextView->setMinimumSize(fm.width ('m') * 40, fm.lineSpacing() * 4 + 4 * 2);
-                }
-                /* Create details splitter: */
-                m_pDetailsSplitter = new QIArrowSplitter(m_pDetailsTextView);
-                {
-                    /* Configure splitter: */
-                    connect(m_pDetailsSplitter, SIGNAL(showBackDetails()), this, SLOT(detailsBack()));
-                    connect(m_pDetailsSplitter, SIGNAL(showNextDetails()), this, SLOT(detailsNext()));
-                    connect(m_pDetailsSplitter, SIGNAL(sigSizeChanged()), this, SLOT(sltUpdateSize()));
-                }
-                /* Create details check-box: */
-                m_pFlagCheckBox_Details = new QCheckBox;
-                {
-                    /* Configure check-box: */
-                    m_pFlagCheckBox_Details->hide();
-                    m_pFlagCheckBox_Details->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-                }
-                /* Configure layout: */
-                VBoxGlobal::setLayoutMargin(pDetailsWidgetLayout, 0);
-                pDetailsWidgetLayout->setSpacing(10);
-                pDetailsWidgetLayout->addWidget(m_pDetailsSplitter);
-                pDetailsWidgetLayout->addWidget(m_pFlagCheckBox_Details);
-            }
+            /* Configure text-view: */
+            m_pDetailsTextView->setReadOnly(true);
+            m_pDetailsTextView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
+            /* Calculate the minimum size dynamically, approx. for 40 chars, 4 lines & 2 <table> margins: */
+            QFontMetrics fm = m_pDetailsTextView->fontMetrics();
+            m_pDetailsTextView->setMinimumSize(fm.width ('m') * 40, fm.lineSpacing() * 4 + 4 * 2);
+        }
+        /* Create details-container: */
+        m_pDetailsContainer = new QIArrowSplitter(m_pDetailsTextView);
+        {
+            /* Configure container: */
+            connect(m_pDetailsContainer, SIGNAL(showBackDetails()), this, SLOT(detailsBack()));
+            connect(m_pDetailsContainer, SIGNAL(showNextDetails()), this, SLOT(detailsNext()));
+            connect(m_pDetailsContainer, SIGNAL(sigSizeChanged()), this, SLOT(sltUpdateSize()));
+            /* And update container finally: */
+            updateDetailsContainer();
+        }
+        /* Create details check-box: */
+        m_pFlagCheckBox = new QCheckBox;
+        {
+            /* Configure check-box: */
+            m_pFlagCheckBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+            /* And update check-box finally: */
+            updateCheckBox();
         }
         /* Create button-box: */
@@ -237,123 +280,53 @@
 #ifdef Q_WS_MAC
         pMainLayout->setContentsMargins(40, 11, 40, 11);
+        pMainLayout->setSpacing(15);
 #else /* !Q_WS_MAC */
         VBoxGlobal::setLayoutMargin(pMainLayout, 11);
+        pMainLayout->setSpacing(10);
 #endif /* !Q_WS_MAC */
-        pMainLayout->setSpacing(10);
         pMainLayout->addLayout(pTopLayout);
-        pMainLayout->addWidget(m_pDetailsWidget);
+        pMainLayout->addWidget(m_pDetailsContainer);
+        pMainLayout->addWidget(m_pFlagCheckBox, 0, Qt::AlignHCenter | Qt::AlignVCenter);
         pMainLayout->addWidget(m_pButtonBox);
     }
-
-    /* Initialize m_pFlagCheckBox: */
-    setDetailsShown(false);
-}
-
-QPushButton *QIMessageBox::createButton (int aButton)
-{
-    if (aButton == 0)
+}
+
+QPushButton* QIMessageBox::createButton(int iButton)
+{
+    /* Not for AlertButton_NoButton: */
+    if (iButton == 0)
         return 0;
 
-    QString text;
+    /* Prepare button text & role: */
+    QString strText;
     QDialogButtonBox::ButtonRole role;
-    switch (aButton & AlertButtonMask)
-    {
-        case AlertButton_Ok:     text = tr("OK");     role = QDialogButtonBox::AcceptRole; break;
-        case AlertButton_Cancel: text = tr("Cancel"); role = QDialogButtonBox::RejectRole; break;
-        case AlertButton_Yes:    text = tr("Yes");    role = QDialogButtonBox::YesRole; break;
-        case AlertButton_No:     text = tr("No");     role = QDialogButtonBox::NoRole; break;
-        case AlertButton_Ignore: text = tr("Ignore"); role = QDialogButtonBox::AcceptRole; break;
-        case AlertButton_Copy:   text = tr("Copy");   role = QDialogButtonBox::ActionRole; break;
+    switch (iButton & AlertButtonMask)
+    {
+        case AlertButton_Ok:     strText = tr("OK");     role = QDialogButtonBox::AcceptRole; break;
+        case AlertButton_Cancel: strText = tr("Cancel"); role = QDialogButtonBox::RejectRole; break;
+        case AlertButton_Yes:    strText = tr("Yes");    role = QDialogButtonBox::YesRole; break;
+        case AlertButton_No:     strText = tr("No");     role = QDialogButtonBox::NoRole; break;
+        case AlertButton_Ignore: strText = tr("Ignore"); role = QDialogButtonBox::AcceptRole; break;
+        case AlertButton_Copy:   strText = tr("Copy");   role = QDialogButtonBox::ActionRole; break;
         default:
-            AssertMsgFailed(("Type %d is not implemented", aButton));
-            return NULL;
-    }
-
-    QPushButton *b = m_pButtonBox->addButton (text, role);
-
-    if (aButton & AlertButtonOption_Default)
-    {
-        b->setDefault (true);
-        b->setFocus();
-    }
-
-    if (aButton & AlertButtonOption_Escape)
-        m_iButtonEsc = aButton & AlertButtonMask;
-
-    return b;
-}
-
-/** @fn QIMessageBox::detailsText() const
- *
- *  Returns the text of the optional details box. The details box is empty
- *  by default, so QString::null will be returned.
- *
- *  @see #setDetailsText()
- */
-
-/**
- *  Sets the text for the optional details box. Note that the details box
- *  is hidden by default, call #setDetailsShown(true) to make it visible.
- *
- *  @see #detailsText()
- *  @see #setDetailsShown()
- */
-void QIMessageBox::setDetailsText (const QString &aText)
-{
-    AssertMsg (!aText.isEmpty(), ("Details text should NOT be empty."));
-
-    QStringList paragraphs (aText.split ("<!--EOP-->", QString::SkipEmptyParts));
-    AssertMsg (paragraphs.size() != 0, ("There should be at least one paragraph."));
-
-    foreach (QString paragraph, paragraphs)
-    {
-        QStringList parts (paragraph.split ("<!--EOM-->", QString::KeepEmptyParts));
-        AssertMsg (parts.size() == 2, ("Each paragraph should consist of 2 parts."));
-        m_detailsList << QPair <QString, QString> (parts [0], parts [1]);
-    }
-
-    m_pDetailsSplitter->setMultiPaging (m_detailsList.size() > 1);
-    m_iDetailsIndex = 0;
-    refreshDetails();
-}
-
-QPixmap QIMessageBox::standardPixmap(AlertIconType aIcon)
-{
-    QIcon icon;
-    switch (aIcon)
-    {
-        case AlertIconType_Information:
-            icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxInformationIcon, this);
-            break;
-        case QMessageBox::Warning:
-            icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxWarningIcon, this);
-            break;
-        case AlertIconType_Critical:
-            icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxCriticalIcon, this);
-            break;
-        case AlertIconType_Question:
-            icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxQuestionIcon, this);
-            break;
-        case AlertIconType_GuruMeditation:
-            icon = QIcon(":/meditation_32px.png");
-            break;
-        default:
-            break;
-    }
-    if (!icon.isNull())
-    {
-        int size = style()->pixelMetric (QStyle::PM_MessageBoxIconSize, 0, this);
-        return icon.pixmap (size, size);
-    }
-    else
-        return QPixmap();
-}
-
-void QIMessageBox::closeEvent (QCloseEvent *e)
-{
-    if (m_fDone)
-        e->accept();
-    else
-        e->ignore();
+            AssertMsgFailed(("Type %d is not supported!", iButton));
+            return 0;
+    }
+
+    /* Create push-button: */
+    QPushButton *pButton = m_pButtonBox->addButton(strText, role);
+
+    /* Configure <default> button: */
+    if (iButton & AlertButtonOption_Default)
+    {
+        pButton->setDefault(true);
+        pButton->setFocus();
+    }
+    /* Configure <escape> button: */
+    if (iButton & AlertButtonOption_Escape)
+        m_iButtonEsc = iButton & AlertButtonMask;
+
+    /* Return button: */
+    return pButton;
 }
 
@@ -361,5 +334,4 @@
 {
     /* Tune our size: */
-    resize(minimumSizeHint());
     m_pTextLabel->useSizeHintForWidth(m_pTextLabel->width());
     m_pTextLabel->updateGeometry();
@@ -370,125 +342,83 @@
     /* Make the size fixed: */
     setFixedSize(size());
-
-    /* Toggle details-widget: */
-    m_pDetailsSplitter->toggleWidget();
-}
-
-void QIMessageBox::refreshDetails()
-{
-    /* Update message text iteself */
-    m_pTextLabel->setText (m_strMessage + m_detailsList [m_iDetailsIndex].first);
-    /* Update details table */
-    m_pDetailsTextView->setText (m_detailsList [m_iDetailsIndex].second);
-    setDetailsShown (!m_pDetailsTextView->toPlainText().isEmpty());
-
-    /* Update multi-paging system */
-    if (m_detailsList.size() > 1)
-    {
-        m_pDetailsSplitter->setButtonEnabled (true, m_iDetailsIndex < m_detailsList.size() - 1);
-        m_pDetailsSplitter->setButtonEnabled (false, m_iDetailsIndex > 0);
-    }
-
-    /* Update details label */
-    m_pDetailsSplitter->setName (m_detailsList.size() == 1 ? tr ("&Details") :
-        tr ("&Details (%1 of %2)").arg (m_iDetailsIndex + 1).arg (m_detailsList.size()));
-}
-
-/**
- *  Sets the visibility state of the optional details box
- *  to a value of the argument.
- *
- *  @see #isDetailsShown()
- *  @see #setDetailsText()
- */
-void QIMessageBox::setDetailsShown (bool aShown)
-{
-    if (aShown)
-    {
-        m_pFlagCheckBox_Details->setVisible (m_pFlagCheckBox_Main->isVisible());
-        m_pFlagCheckBox_Details->setChecked (m_pFlagCheckBox_Main->isChecked());
-        m_pFlagCheckBox_Details->setText (m_pFlagCheckBox_Main->text());
-        if (m_pFlagCheckBox_Main->hasFocus())
-            m_pFlagCheckBox_Details->setFocus();
-        m_pFlagCheckBox_Main->setVisible (false);
-        m_pFlagCheckBox = m_pFlagCheckBox_Details;
-    }
-
-    m_pDetailsWidget->setVisible (aShown);
-
-    if (!aShown)
-    {
-        m_pFlagCheckBox_Main->setVisible (m_pFlagCheckBox_Details->isVisible());
-        m_pFlagCheckBox_Main->setChecked (m_pFlagCheckBox_Details->isChecked());
-        m_pFlagCheckBox_Main->setText (m_pFlagCheckBox_Details->text());
-        if (m_pFlagCheckBox_Details->hasFocus())
-            m_pFlagCheckBox_Main->setFocus();
-        m_pFlagCheckBox = m_pFlagCheckBox_Main;
-    }
-}
-
-void QIMessageBox::sltUpdateSize()
-{
-    /* Update/activate all the layouts of the message-box: */
-    QList<QLayout*> layouts = findChildren<QLayout*>();
-    for (int i = 0; i < layouts.size(); ++i)
-    {
-        QLayout *pItem = layouts.at(i);
-        pItem->update();
-        pItem->activate();
-    }
-    QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
-
-    /* Now resize message-box to the minimum possible size: */
-    setFixedSize(minimumSizeHint());
-}
-
-void QIMessageBox::detailsBack()
-{
-    if (m_iDetailsIndex > 0)
-    {
-        -- m_iDetailsIndex;
-        refreshDetails();
-    }
-}
-
-void QIMessageBox::detailsNext()
-{
-    if (m_iDetailsIndex < m_detailsList.size() - 1)
-    {
-        ++ m_iDetailsIndex;
-        refreshDetails();
-    }
-}
-
-void QIMessageBox::reject()
-{
-    if (m_iButtonEsc)
-    {
-        QDialog::reject();
-        setResult (m_iButtonEsc & AlertButtonMask);
-    }
-}
-
-void QIMessageBox::copy() const
-{
-    /* Create the error string with all errors. First the html version. */
-    QString strError = "<html><body><p>" + m_strMessage + "</p>";
-    for (int i = 0; i < m_detailsList.size(); ++i)
-        strError += m_detailsList.at(i).first + m_detailsList.at(i).second + "<br>";
-    strError += "</body></html>";
-    strError.remove(QRegExp("</+qt>"));
-    strError = strError.replace(QRegExp("&nbsp;"), " ");
-    /* Create a new mime data object holding both the html and the plain text version. */
-    QMimeData *pMd = new QMimeData();
-    pMd->setHtml(strError);
-    /* Replace all the html entities. */
-    strError = strError.replace(QRegExp("<br>|</tr>"), "\n");
-    strError = strError.replace(QRegExp("</p>"), "\n\n");
-    strError = strError.remove(QRegExp("<[^>]*>"));
-    pMd->setText(strError);
-    /* Add the mime data to the global clipboard. */
-    QClipboard *pClipboard = QApplication::clipboard();
-    pClipboard->setMimeData(pMd);
-}
-
+}
+
+void QIMessageBox::closeEvent(QCloseEvent *pCloseEvent)
+{
+    if (m_fDone)
+        pCloseEvent->accept();
+    else
+        pCloseEvent->ignore();
+}
+
+void QIMessageBox::updateDetailsContainer()
+{
+    /* Do we have details to show? */
+    m_pDetailsContainer->setVisible(!m_details.isEmpty());
+
+    /* Reset the details page index: */
+    m_iDetailsIndex = m_details.isEmpty() ? -1 : 0;
+
+    /* Do we have any details? */
+    if (m_details.isEmpty())
+        m_pDetailsContainer->setName(QString());
+    else if (m_details.size() == 1)
+        m_pDetailsContainer->setName(tr("&Details"));
+    else
+        m_pDetailsContainer->setMultiPaging(true);
+
+    /* Do we have any details? */
+    if (!m_details.isEmpty())
+        updateDetailsPage();
+}
+
+void QIMessageBox::updateDetailsPage()
+{
+    /* Make sure details-page index feats the bounds: */
+    if (m_iDetailsIndex < 0 || m_iDetailsIndex >= m_details.size())
+        return;
+
+    /* Update message text-label: */
+    m_pTextLabel->setText(m_strMessage + m_details[m_iDetailsIndex].first);
+
+    /* Update details text-view: */
+    m_pDetailsTextView->setText(m_details[m_iDetailsIndex].second);
+
+    /* Update details-container: */
+    if (m_details.size() > 1)
+    {
+        m_pDetailsContainer->setName(tr("&Details (%1 of %2)").arg(m_iDetailsIndex + 1).arg(m_details.size()));
+        m_pDetailsContainer->setButtonEnabled(true, m_iDetailsIndex < m_details.size() - 1);
+        m_pDetailsContainer->setButtonEnabled(false, m_iDetailsIndex > 0);
+    }
+}
+
+void QIMessageBox::updateCheckBox()
+{
+    /* Flag check-box with text is always visible: */
+    m_pFlagCheckBox->setVisible(!m_pFlagCheckBox->text().isEmpty());
+}
+
+/* static */
+QPixmap QIMessageBox::standardPixmap(AlertIconType iconType, QWidget *pWidget /*= 0*/)
+{
+    /* Prepare standard icon: */
+    QIcon icon;
+    switch (iconType)
+    {
+        case AlertIconType_Information:    icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxInformationIcon, pWidget); break;
+        case AlertIconType_Warning:        icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxWarningIcon, pWidget); break;
+        case AlertIconType_Critical:       icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxCriticalIcon, pWidget); break;
+        case AlertIconType_Question:       icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxQuestionIcon, pWidget); break;
+        case AlertIconType_GuruMeditation: icon = UIIconPool::iconSet(":/meditation_32px.png"); break;
+        default: break;
+    }
+    /* Return empty pixmap if nothing found: */
+    if (icon.isNull())
+        return QPixmap();
+    /* Return pixmap of standard size if possible: */
+    QStyle *pStyle = pWidget ? pWidget->style() : QApplication::style();
+    int iSize = pStyle->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, pWidget);
+    return icon.pixmap(iSize, iSize);
+}
+
Index: /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.h	(revision 45307)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.h	(revision 45308)
@@ -21,7 +21,5 @@
 
 /* Qt includes: */
-#include <QCheckBox>
 #include <QMessageBox>
-#include <QTextEdit>
 
 /* GUI includes: */
@@ -29,10 +27,13 @@
 
 /* Forward declarations: */
+class QShowEvent;
 class QCloseEvent;
 class QLabel;
+class QTextEdit;
+class QCheckBox;
 class QPushButton;
+class QILabel;
 class QIArrowSplitter;
 class QIDialogButtonBox;
-class QILabel;
 
 /* Button type enumerator: */
@@ -86,47 +87,55 @@
                  int iButton1 = 0, int iButton2 = 0, int iButton3 = 0, QWidget *pParent = 0);
 
-    QString buttonText (int aButton) const;
-    void setButtonText (int aButton, const QString &aText);
+    /* API: Details stuff: */
+    QString detailsText() const;
+    void setDetailsText(const QString &strText);
 
-    QString flagText() const { return m_pFlagCheckBox->isVisible() ? m_pFlagCheckBox->text() : QString::null; }
-    void setFlagText (const QString &aText);
+    /* API: Flag stuff: */
+    bool flagChecked() const;
+    void setFlagChecked(bool fChecked);
+    QString flagText() const;
+    void setFlagText(const QString &strText);
 
-    bool isFlagChecked() const { return m_pFlagCheckBox->isChecked(); }
-    void setFlagChecked (bool aChecked) { m_pFlagCheckBox->setChecked (aChecked); }
+    /* API: Button stuff: */
+    QString buttonText(int iButton) const;
+    void setButtonText(int iButton, const QString &strText);
 
-    QString detailsText () const { return m_pDetailsTextView->toHtml(); }
-    void setDetailsText (const QString &aText);
+private slots:
 
-    QPixmap standardPixmap(AlertIconType aIcon);
+    /* Handler: Reject slot reimplementation: */
+    void reject();
+
+    /* Handlers: Done slot variants for up to three buttons: */
+    void done1() { m_fDone = true; done(m_iButton1 & AlertButtonMask); }
+    void done2() { m_fDone = true; done(m_iButton2 & AlertButtonMask); }
+    void done3() { m_fDone = true; done(m_iButton3 & AlertButtonMask); }
+
+    /* Handler: Copy button stuff: */
+    void copy() const;
+
+    /* Handlers: Details navigation stuff: */
+    void detailsBack();
+    void detailsNext();
+
+    /* Handler: Update stuff: */
+    void sltUpdateSize();
 
 private:
 
-    /* Helper: Prepare stuff: */
+    /* Helpers: Prepare stuff: */
     void prepareContent();
+    QPushButton* createButton(int iButton);
 
-    QPushButton *createButton (int aButton);
+    /* Handler: Event-processing stuff: */
+    void polishEvent(QShowEvent *pPolishEvent);
+    void closeEvent(QCloseEvent *pCloseEvent);
 
-    void closeEvent (QCloseEvent *e);
-    void polishEvent(QShowEvent *pPolishEvent);
+    /* Helpers: Update stuff: */
+    void updateDetailsContainer();
+    void updateDetailsPage();
+    void updateCheckBox();
 
-    void refreshDetails();
-    void setDetailsShown (bool aShown);
-
-private slots:
-
-    void sltUpdateSize();
-
-    void detailsBack();
-    void detailsNext();
-
-    void done1() { m_fDone = true; done (m_iButton1 & AlertButtonMask); }
-    void done2() { m_fDone = true; done (m_iButton2 & AlertButtonMask); }
-    void done3() { m_fDone = true; done (m_iButton3 & AlertButtonMask); }
-
-    void reject();
-
-    void copy() const;
-
-private:
+    /* Static helper: Standard pixmap stuff: */
+    static QPixmap standardPixmap(AlertIconType iconType, QWidget *pWidget = 0);
 
     /* Variables: */
@@ -136,11 +145,10 @@
     QILabel *m_pTextLabel;
     QPushButton *m_pButton1, *m_pButton2, *m_pButton3;
-    QCheckBox *m_pFlagCheckBox, *m_pFlagCheckBox_Main, *m_pFlagCheckBox_Details;
-    QWidget *m_pDetailsWidget;
-    QIArrowSplitter *m_pDetailsSplitter;
+    QCheckBox *m_pFlagCheckBox;
+    QIArrowSplitter *m_pDetailsContainer;
     QTextEdit *m_pDetailsTextView;
     QIDialogButtonBox *m_pButtonBox;
     QString m_strMessage;
-    QList<QPair<QString, QString> > m_detailsList;
+    QList<QPair<QString, QString> > m_details;
     int m_iDetailsIndex;
     bool m_fDone : 1;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp	(revision 45307)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp	(revision 45308)
@@ -195,5 +195,5 @@
 
     /* Save option: */
-    if (pBox->isFlagChecked())
+    if (pBox->flagChecked())
         rc |= AlertOption_CheckBox;
 
@@ -3050,5 +3050,5 @@
     if (!strAutoConfirmId.isEmpty())
     {
-        if (pMessageBox->isFlagChecked())
+        if (pMessageBox->flagChecked())
         {
             confirmedMessageList << strAutoConfirmId;
