Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp	(revision 45467)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp	(revision 45468)
@@ -20,10 +20,15 @@
 /* Qt includes: */
 #include <QVBoxLayout>
-#include <QLabel>
+#include <QPushButton>
+#include <QEvent>
 
 /* GUI includes: */
 #include "UIPopupCenter.h"
-#include "QIMessageBox.h"
 #include "UIModalWindowManager.h"
+#include "QIRichTextLabel.h"
+#include "QIDialogButtonBox.h"
+
+/* Other VBox includes: */
+#include <VBox/sup.h>
 
 /* static */
@@ -149,10 +154,249 @@
 }
 
-void UIPopupCenter::showPopupBox(QWidget *,
-                                 const QString &, const QString &,
-                                 int , int , int ,
-                                 const QString &, const QString &, const QString &,
-                                 const QString &) const
-{
-}
-
+void UIPopupCenter::showPopupBox(QWidget *pParent,
+                                 const QString &strMessage, const QString &strDetails,
+                                 int iButton1, int iButton2, int iButton3,
+                                 const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,
+                                 const QString &strAutoConfirmId) const
+{
+    /* Choose at least one button by 'default': */
+    if (iButton1 == 0 && iButton2 == 0 && iButton3 == 0)
+        iButton1 = AlertButton_Ok | AlertButtonOption_Default;
+
+    /* Create popup-box window: */
+    QWidget *pPopupBoxParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown());
+    UIPopupPane *pPopupBox = new UIPopupPane(pPopupBoxParent, strAutoConfirmId,
+                                             strMessage, strDetails,
+                                             iButton1, iButton2, iButton3,
+                                             strButtonText1, strButtonText2, strButtonText3);
+    m_popups.insert(strAutoConfirmId, pPopupBox);
+    connect(pPopupBox, SIGNAL(sigDone(int)), this, SLOT(sltPopupDone(int)));
+    pPopupBox->show();
+}
+
+void UIPopupCenter::sltPopupDone(int iButtonCode) const
+{
+    /* Make sure the sender is popup: */
+    UIPopupPane *pPopup = qobject_cast<UIPopupPane*>(sender());
+    if (!pPopup)
+        return;
+
+    /* Get the popup ID: */
+    const QString strPopupID(pPopup->id());
+
+    /* Make sure the popup still here: */
+    const bool fIsPopupStillHere = m_popups.contains(strPopupID);
+    AssertMsg(fIsPopupStillHere, ("Popup already destroyed!"));
+    if (!fIsPopupStillHere)
+        return;
+
+    /* Notify listeners: */
+    emit sigPopupDone(strPopupID, iButtonCode);
+
+    /* Cleanup the popup: */
+    m_popups.remove(strPopupID);
+    delete pPopup;
+}
+
+UIPopupPane::UIPopupPane(QWidget *pParent, const QString &strId,
+                         const QString &strMessage, const QString &strDetails,
+                         int iButton1, int iButton2, int iButton3,
+                         const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3)
+    : QWidget(pParent, Qt::Window | Qt::FramelessWindowHint)
+    , m_fPolished(false)
+    , m_strId(strId)
+    , m_strMessage(strMessage)
+    , m_strDetails(strDetails)
+    , m_iButton1(iButton1)
+    , m_iButton2(iButton2)
+    , m_iButton3(iButton3)
+    , m_strButtonText1(strButtonText1)
+    , m_strButtonText2(strButtonText2)
+    , m_strButtonText3(strButtonText3)
+{
+    /* Make sure popup will NOT be deleted on close: */
+    setAttribute(Qt::WA_DeleteOnClose, false);
+    /* Install event-filter: */
+    pParent->installEventFilter(this);
+    /* Configure window: */
+    setWindowOpacity(0.7);
+
+    /* Prepare content: */
+    prepareContent();
+}
+
+UIPopupPane::~UIPopupPane()
+{
+}
+
+bool UIPopupPane::eventFilter(QObject *pWatched, QEvent *pEvent)
+{
+    /* Make sure its parent event came: */
+    if (pWatched != parent())
+        return false;
+
+    /* Make sure its move|rezize event came: */
+    if (   pEvent->type() != QEvent::Move
+        && pEvent->type() != QEvent::Resize)
+        return false;
+
+    /* Process event: */
+    switch (pEvent->type())
+    {
+        /* Move event: */
+        case QEvent::Move:
+        {
+            moveAccordingParent();
+            break;
+        }
+        /* Resize event: */
+        case QEvent::Resize:
+        {
+            resizeAccordingParent();
+            break;
+        }
+        /* Default case: */
+        default: break;
+    }
+
+    /* Do not filter by default: */
+    return false;
+}
+
+void UIPopupPane::showEvent(QShowEvent *pEvent)
+{
+    /* Make sure we should polish dialog: */
+    if (m_fPolished)
+        return;
+
+    /* Call to polish-event: */
+    polishEvent(pEvent);
+
+    /* Mark dialog as polished: */
+    m_fPolished = true;
+}
+
+void UIPopupPane::polishEvent(QShowEvent*)
+{
+    /* Tune geometry: */
+    moveAccordingParent();
+    resizeAccordingParent();
+}
+
+void UIPopupPane::moveAccordingParent()
+{
+    /* Move according parent: */
+    QRect geo = parentWidget()->geometry();
+    move(geo.x(), geo.y());
+}
+
+void UIPopupPane::resizeAccordingParent()
+{
+    /* Resize according parent: */
+    int iWidth = parentWidget()->width();
+    resize(iWidth, minimumSizeHint().height());
+
+    /* Resize text-pane according new size: */
+    int iMinimumTextWidth = iWidth;
+    int iLeft, iTop, iRight, iBottom;
+    m_pMainLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom);
+    iMinimumTextWidth -= iLeft;
+    iMinimumTextWidth -= iRight;
+    m_pTextPane->setMinimumTextWidth(iMinimumTextWidth);
+}
+
+void UIPopupPane::prepareContent()
+{
+    /* Crete main-layout: */
+    m_pMainLayout = new QVBoxLayout(this);
+    {
+        /* Configure layout: */
+#ifdef Q_WS_MAC
+        m_pMainLayout->setContentsMargins(20, 5, 20, 5);
+        m_pMainLayout->setSpacing(0);
+#else /* Q_WS_MAC */
+        m_pMainLayout->setContentsMargins(5, 5, 5, 5);
+        m_pMainLayout->setSpacing(5);
+#endif /* !Q_WS_MAC */
+        /* Create message-label: */
+        m_pTextPane = new QIRichTextLabel;
+        {
+            /* Add into layout: */
+            m_pMainLayout->addWidget(m_pTextPane);
+            /* Configure label: */
+            m_pTextPane->setText(m_strMessage);
+            m_pTextPane->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
+        }
+        /* Create button-box: */
+        m_pButtonBox = new QIDialogButtonBox;
+        {
+            /* Add into layout: */
+            m_pMainLayout->addWidget(m_pButtonBox);
+            /* Configure button-box: */
+            m_pButton1 = createButton(m_iButton1);
+            if (m_pButton1)
+            {
+                if (!m_strButtonText1.isEmpty())
+                    m_pButton1->setText(m_strButtonText1);
+                connect(m_pButton1, SIGNAL(clicked()), SLOT(done1()));
+            }
+            m_pButton2 = createButton(m_iButton2);
+            if (m_pButton2)
+            {
+                if (!m_strButtonText2.isEmpty())
+                    m_pButton1->setText(m_strButtonText2);
+                connect(m_pButton2, SIGNAL(clicked()), SLOT(done2()));
+            }
+            m_pButton3 = createButton(m_iButton3);
+            if (m_pButton3)
+            {
+                if (!m_strButtonText3.isEmpty())
+                    m_pButton1->setText(m_strButtonText3);
+                connect(m_pButton3, SIGNAL(clicked()), SLOT(done3()));
+            }
+        }
+    }
+}
+
+QPushButton* UIPopupPane::createButton(int iButton)
+{
+    /* Not for AlertButton_NoButton: */
+    if (iButton == 0)
+        return 0;
+
+    /* Prepare button text & role: */
+    QString strText;
+    QDialogButtonBox::ButtonRole role;
+    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_Choice1: strText = tr("Yes");    role = QDialogButtonBox::YesRole; break;
+        case AlertButton_Choice2: strText = tr("No");     role = QDialogButtonBox::NoRole; break;
+        case AlertButton_Copy:    strText = tr("Copy");   role = QDialogButtonBox::ActionRole; break;
+        default: return 0;
+    }
+
+    /* Create push-button: */
+    QPushButton *pButton = m_pButtonBox->addButton(strText, role);
+
+    /* Configure <default> button: */
+    if (iButton & AlertButtonOption_Default)
+    {
+        pButton->setDefault(true);
+        pButton->setFocus();
+    }
+
+    /* Return button: */
+    return pButton;
+}
+
+void UIPopupPane::done(int iButtonCode)
+{
+    /* Close the window: */
+    close();
+
+    /* Notify listeners: */
+    emit sigDone(iButtonCode);
+}
+
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h	(revision 45467)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h	(revision 45468)
@@ -23,5 +23,16 @@
 #include <QMap>
 #include <QObject>
+#include <QWidget>
 #include <QPointer>
+
+/* GUI includes: */
+#include "QIMessageBox.h"
+
+/* Forward declaration: */
+class UIPopupPane;
+class QVBoxLayout;
+class QPushButton;
+class QIRichTextLabel;
+class QIDialogButtonBox;
 
 /* Global popup-center object: */
@@ -29,4 +40,9 @@
 {
     Q_OBJECT;
+
+signals:
+
+    /* Notifier: Popup complete stuff: */
+    void sigPopupDone(QString strId, int iButtonCode) const;
 
 public:
@@ -84,4 +100,9 @@
                          const QString &strCancelButtonText = QString()) const;
 
+private slots:
+
+    /* Handler: Popup done stuff: */
+    void sltPopupDone(int iButtonCode) const;
+
 private:
 
@@ -98,5 +119,5 @@
 
     /* Variables: */
-    mutable QMap<QString, QPointer<QWidget> > m_popups;
+    mutable QMap<QString, QPointer<UIPopupPane> > m_popups;
 
     /* Instance stuff: */
@@ -109,4 +130,66 @@
 inline UIPopupCenter& popupCenter() { return *UIPopupCenter::instance(); }
 
+/* Popup-pane prototype class: */
+class UIPopupPane : public QWidget
+{
+    Q_OBJECT;
+
+signals:
+
+    /* Notifier: Complete stuff: */
+    void sigDone(int iButtonCode) const;
+
+public:
+
+    /* Constructor/destructor: */
+    UIPopupPane(QWidget *pParent, const QString &strId,
+                const QString &strMessage, const QString &strDetails,
+                int iButton1, int iButton2, int iButton3,
+                const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3);
+    ~UIPopupPane();
+
+    /* API: Id stuff: */
+    const QString& id() const { return m_strId; }
+
+private slots:
+
+    /* Handlers: Done slot variants for every button: */
+    void done1() { done(m_iButton1 & AlertButtonMask); }
+    void done2() { done(m_iButton2 & AlertButtonMask); }
+    void done3() { done(m_iButton3 & AlertButtonMask); }
+
+private:
+
+    /* Handler: Event-filter stuff: */
+    bool eventFilter(QObject *pWatched, QEvent *pEvent);
+
+    /* Handlers: Event stuff: */
+    virtual void showEvent(QShowEvent *pEvent);
+    virtual void polishEvent(QShowEvent *pEvent);
+
+    /* Helpers: Move/resize stuff: */
+    void moveAccordingParent();
+    void resizeAccordingParent();
+
+    /* Helpers: Prepare stuff: */
+    void prepareContent();
+    QPushButton* createButton(int iButton);
+
+    /* Helper: */
+    void done(int iButtonCode);
+
+    /* Variables: */
+    bool m_fPolished;
+    const QString m_strId;
+    QString m_strMessage, m_strDetails;
+    int m_iButton1, m_iButton2, m_iButton3;
+    QString m_strButtonText1, m_strButtonText2, m_strButtonText3;
+
+    /* Widgets: */
+    QVBoxLayout *m_pMainLayout;
+    QIRichTextLabel *m_pTextPane;
+    QPushButton *m_pButton1, *m_pButton2, *m_pButton3;
+    QIDialogButtonBox *m_pButtonBox;
+};
+
 #endif /* __UIPopupCenter_h__ */
-
