Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp	(revision 31877)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp	(revision 31877)
@@ -0,0 +1,127 @@
+/* $Id$ */
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxLicenseViewer class implementation
+ */
+
+/*
+ * Copyright (C) 2006-2010 Oracle Corporation
+ *
+ * Oracle Corporation confidential
+ * All rights reserved
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include "precomp.h"
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+#include "VBoxLicenseViewer.h"
+#include "QIDialogButtonBox.h"
+#include "VBoxGlobal.h"
+#include "VBoxProblemReporter.h"
+
+/* Qt includes */
+#include <QTextBrowser>
+#include <QPushButton>
+#include <QVBoxLayout>
+#include <QScrollBar>
+#include <QFile>
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+VBoxLicenseViewer::VBoxLicenseViewer (const QString &aFilePath)
+    : QIWithRetranslateUI<QDialog> ()
+      , mFilePath (aFilePath)
+      , mLicenseText (0)
+      , mAgreeButton (0)
+      , mDisagreeButton (0)
+{
+#ifndef Q_WS_WIN
+    /* Application icon. On Win32, it's built-in to the executable. */
+    setWindowIcon (QIcon (":/VirtualBox_48px.png"));
+#endif
+
+    mLicenseText = new QTextBrowser (this);
+    mAgreeButton = new QPushButton (this);
+    mDisagreeButton = new QPushButton (this);
+    QDialogButtonBox *dbb = new QIDialogButtonBox (this);
+    dbb->addButton (mAgreeButton, QDialogButtonBox::AcceptRole);
+    dbb->addButton (mDisagreeButton, QDialogButtonBox::RejectRole);
+
+    connect (mLicenseText->verticalScrollBar(), SIGNAL (valueChanged (int)),
+             SLOT (onScrollBarMoving (int)));
+    connect (mAgreeButton, SIGNAL (clicked()), SLOT (accept()));
+    connect (mDisagreeButton, SIGNAL (clicked()), SLOT (reject()));
+
+    QVBoxLayout *mainLayout = new QVBoxLayout (this);
+    mainLayout->setSpacing (10);
+    VBoxGlobal::setLayoutMargin (mainLayout, 10);
+    mainLayout->addWidget (mLicenseText);
+    mainLayout->addWidget (dbb);
+
+    mLicenseText->verticalScrollBar()->installEventFilter (this);
+
+    resize (600, 450);
+
+    retranslateUi();
+}
+
+int VBoxLicenseViewer::exec()
+{
+    /* read & show the license file */
+    QFile file (mFilePath);
+    if (file.open (QIODevice::ReadOnly))
+    {
+        mLicenseText->setText (file.readAll());
+        return QDialog::exec();
+    }
+    else
+    {
+        vboxProblem().cannotOpenLicenseFile (this, mFilePath);
+        return QDialog::Rejected;
+    }
+}
+
+void VBoxLicenseViewer::retranslateUi()
+{
+    setWindowTitle (tr ("VirtualBox License"));
+
+    mAgreeButton->setText (tr ("I &Agree"));
+    mDisagreeButton->setText (tr ("I &Disagree"));
+}
+
+void VBoxLicenseViewer::onScrollBarMoving (int aValue)
+{
+    if (aValue == mLicenseText->verticalScrollBar()->maximum())
+        unlockButtons();
+}
+
+void VBoxLicenseViewer::unlockButtons()
+{
+    mAgreeButton->setEnabled (true);
+    mDisagreeButton->setEnabled (true);
+}
+
+void VBoxLicenseViewer::showEvent (QShowEvent *aEvent)
+{
+    QDialog::showEvent (aEvent);
+    bool isScrollBarHidden = mLicenseText->verticalScrollBar()->isHidden()
+        && !(windowState() & Qt::WindowMinimized);
+    mAgreeButton->setEnabled (isScrollBarHidden);
+    mDisagreeButton->setEnabled (isScrollBarHidden);
+}
+
+bool VBoxLicenseViewer::eventFilter (QObject *aObject, QEvent *aEvent)
+{
+    switch (aEvent->type())
+    {
+        case QEvent::Hide:
+            if (aObject == mLicenseText->verticalScrollBar())
+                /* Doesn't work on wm's like ion3 where the window starts
+                 * maximized: isActiveWindow() */
+                unlockButtons();
+        default:
+            break;
+    }
+    return QDialog::eventFilter (aObject, aEvent);
+}
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.h	(revision 31877)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.h	(revision 31877)
@@ -0,0 +1,64 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxLicenseViewer class declaration
+ */
+
+/*
+ * Copyright (C) 2006-2010 Oracle Corporation
+ *
+ * Oracle Corporation confidential
+ * All rights reserved
+ */
+
+#ifndef __VBoxLicenseViewer__
+#define __VBoxLicenseViewer__
+
+#include "QIWithRetranslateUI.h"
+
+/* Qt includes */
+#include <QDialog>
+
+class QTextBrowser;
+class QPushButton;
+
+/**
+ *  This class is used to show a user license under linux.
+ */
+class VBoxLicenseViewer : public QIWithRetranslateUI<QDialog>
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxLicenseViewer (const QString &aFilePath);
+
+public slots:
+
+    int exec();
+
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    void onScrollBarMoving (int aValue);
+
+    void unlockButtons();
+
+private:
+
+    void showEvent (QShowEvent *aEvent);
+
+    bool eventFilter (QObject *aObject, QEvent *aEvent);
+
+    /* Private member vars */
+    QString       mFilePath;
+    QTextBrowser *mLicenseText;
+    QPushButton  *mAgreeButton;
+    QPushButton  *mDisagreeButton;
+};
+
+#endif /* __VBoxLicenseViewer__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/precomp.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/precomp.h	(revision 31877)
+++ trunk/src/VBox/Frontends/VirtualBox/src/precomp.h	(revision 31877)
@@ -0,0 +1,331 @@
+/* $Id$*/
+/** @file
+ *
+ * Header used if VBOX_WITH_PRECOMPILED_HEADERS is active.
+ */
+
+/*
+ * Copyright (C) 2009-2010 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.
+ */
+
+//#include <Q3PopupMenu>
+#include <QAbstractItemView>
+#include <QAbstractListModel>
+#include <QAbstractScrollArea>
+#include <QAction>
+#include <QActionGroup>
+#include <QApplication>
+#include <QBasicTimer>
+#include <QBitmap>
+#include <QBoxLayout>
+#include <QCheckBox>
+#include <QCleanlooksStyle>
+#include <QClipboard>
+#include <QCloseEvent>
+#include <QColor>
+#include <QComboBox>
+#include <QCompleter>
+#include <QContextMenuEvent>
+#include <QCursor>
+#include <QDate>
+#include <QDateTime>
+#include <QDesktopServices>
+#include <QDesktopWidget>
+#include <QDialog>
+#include <QDialogButtonBox>
+#include <QDir>
+#include <QDragEnterEvent>
+#include <QDropEvent>
+#include <QEvent>
+#include <QEventLoop>
+#include <QFile>
+#include <QFileDialog>
+#include <QFileIconProvider>
+#include <QFileInfo>
+#include <QFocusEvent>
+#include <QFontDatabase>
+#include <QFrame>
+#include <QGLContext>
+#include <QGLWidget>
+#include <QGlobalStatic>
+#include <QHBoxLayout>
+#include <QHash>
+#include <QHeaderView>
+#include <QHelpEvent>
+#include <QHostAddress>
+#include <QHttp>
+#include <QHttpResponseHeader>
+#include <QImage>
+#include <QItemDelegate>
+#include <QItemEditorFactory>
+#include <QKeyEvent>
+#include <QLabel>
+#include <QLayout>
+#include <QLibrary>
+#include <QLibraryInfo>
+#include <QLineEdit>
+#include <QLinkedList>
+#include <QList>
+#include <QListView>
+#include <QLocale>
+#ifdef Q_WS_MAC
+# include <QMacCocoaViewContainer>
+#endif
+#include <QMainWindow>
+#include <QMap>
+#include <QMenu>
+#include <QMenuBar>
+#include <QMenuItem>
+#include <QMessageBox>
+#include <QMetaProperty>
+#include <QMetaType>
+#include <QMimeData>
+#include <QMouseEvent>
+#include <QMoveEvent>
+#include <QMutex>
+#include <QObject>
+#include <QPaintEvent>
+#include <QPainter>
+#include <QPixmap>
+#include <QPlastiqueStyle>
+#include <QPointer>
+#include <QPolygon>
+#include <QPrintDialog>
+#include <QPrinter>
+#include <QProcess>
+#include <QProgressBar>
+#include <QProgressDialog>
+#include <QPushButton>
+#include <QRect>
+#include <QRegExp>
+#include <QRegExpValidator>
+#include <QRegion>
+#include <QResizeEvent>
+#include <QScrollArea>
+#include <QScrollBar>
+#include <QSettings>
+#include <QSignalMapper>
+#include <QSizeGrip>
+#include <QSlider>
+#include <QSocketNotifier>
+#include <QSortFilterProxyModel>
+#include <QSpinBox>
+#include <QSplitter>
+#include <QStackedWidget>
+#include <QStatusBar>
+#include <QString>
+#include <QStyle>
+#include <QStyleOption>
+#include <QStyleOptionFocusRect>
+#include <QStyleOptionFrame>
+#include <QStyleOptionSlider>
+#include <QStylePainter>
+#include <QSystemTrayIcon>
+#include <QTabWidget>
+#include <QTableView>
+#include <QTextBrowser>
+#include <QTextEdit>
+#include <QTextStream>
+#include <QThread>
+#include <QTime>
+#include <QTimer>
+#include <QToolBar>
+#include <QToolButton>
+#include <QToolTip>
+#include <QTranslator>
+#include <QTreeView>
+#include <QTreeWidget>
+#include <QUrl>
+#include <QUuid>
+#include <QVBoxLayout>
+#include <QValidator>
+#include <QVarLengthArray>
+#include <QVariant>
+#include <QVector>
+#include <QWidget>
+#include <QWindowsStyle>
+#include <QWindowsVistaStyle>
+#ifdef Q_WS_X11
+# include <QX11Info>
+#endif
+
+#include "QIAbstractWizard.h"
+#include "QIAdvancedSlider.h"
+#include "QIArrowButtonPress.h"
+#include "QIArrowButtonSwitch.h"
+#include "QIArrowSplitter.h"
+#include "QIDialog.h"
+#include "QIDialogButtonBox.h"
+#include "QIFileDialog.h"
+#if 0
+#include "QIHotKeyEdit.h"
+#endif
+#include "QIHttp.h"
+#include "QILabel.h"
+#include "QILabelSeparator.h"
+#include "QILineEdit.h"
+#include "QIListView.h"
+#include "QIMainDialog.h"
+#include "QIMessageBox.h"
+#include "QIRichToolButton.h"
+#include "QISplitter.h"
+#include "QIStateIndicator.h"
+#include "QIStatusBar.h"
+#include "QIToolButton.h"
+#include "QITreeView.h"
+#include "QITreeWidget.h"
+#include "QIWidgetValidator.h"
+#include "QIWithRetranslateUI.h"
+
+//expensive: #include "AbstractDockIconPreview.h"
+#include "CIShared.h"
+#include "COMDefs.h"
+#ifdef Q_WS_MAC
+# include "DarwinKeyboard.h"
+# include "DockIconPreview.h"
+#endif
+#include "VBoxAboutDlg.h"
+#include "VBoxApplianceEditorWgt.h"
+#include "VBoxCloseVMDlg.h"
+#ifdef Q_WS_MAC
+# include "VBoxCocoaHelper.h"
+# include "VBoxCocoaSpecialControls.h"
+#endif
+#include "VBoxDefs.h"
+#include "VBoxDownloaderWgt.h"
+#include "VBoxExportApplianceWgt.h"
+#include "VBoxExportApplianceWzd.h"
+#include "VBoxFBOverlay.h"
+#include "VBoxFBOverlayCommon.h"
+#include "VBoxFilePathSelectorWidget.h"
+#include "VBoxFrameBuffer.h"
+#include "VBoxGLSettingsGeneral.h"
+#include "VBoxGLSettingsInput.h"
+#include "VBoxGLSettingsLanguage.h"
+#include "VBoxGLSettingsNetwork.h"
+#include "VBoxGLSettingsNetworkDetails.h"
+#include "VBoxGLSettingsUpdate.h"
+#include "VBoxGlobal.h"
+#include "VBoxGlobalSettings.h"
+#include "VBoxGuestRAMSlider.h"
+#include "VBoxHelpActions.h"
+#ifdef Q_WS_MAC
+# include "VBoxIChatTheaterWrapper.h"
+#endif
+#include "VBoxImportApplianceWgt.h"
+#include "VBoxImportApplianceWzd.h"
+#include "VBoxLicenseViewer.h"
+#include "VBoxLineTextEdit.h"
+//#include "VBoxMediaComboBox.h"
+#include "VBoxMediaManagerDlg.h"
+//#include "VBoxMedium.h"               /* Expensive? Or what? */
+#include "VBoxMiniToolBar.h"
+#include "VBoxNewHDWzd.h"
+#include "VBoxNewVMWzd.h"
+#include "VBoxOSTypeSelectorButton.h"
+#include "VBoxOSTypeSelectorWidget.h"
+#include "VBoxProblemReporter.h"
+#include "VBoxProgressDialog.h"
+#include "VBoxRegistrationDlg.h"
+#include "VBoxSelectorWnd.h"
+#include "VBoxSettingsDialog.h"
+#include "VBoxSettingsDialogSpecific.h"
+#include "VBoxSettingsPage.h"
+#include "VBoxSettingsSelector.h"
+#include "VBoxSnapshotDetailsDlg.h"
+#include "VBoxSnapshotsWgt.h"
+#include "VBoxSpecialControls.h"
+#include "VBoxTakeSnapshotDlg.h"
+#include "VBoxToolBar.h"
+#include "VBoxUpdateDlg.h"
+#include "VBoxUtils-darwin.h"
+#include "VBoxUtils.h"
+#include "VBoxVMFirstRunWzd.h"
+#include "VBoxVMInformationDlg.h"
+#include "UIVMListView.h"
+#include "VBoxVMLogViewer.h"
+#include "VBoxVMSettingsAudio.h"
+#include "VBoxVMSettingsDisplay.h"
+#include "VBoxVMSettingsGeneral.h"
+#include "VBoxVMSettingsHD.h"
+#include "VBoxVMSettingsNetwork.h"
+#include "VBoxVMSettingsParallel.h"
+#include "VBoxVMSettingsSF.h"
+#include "VBoxVMSettingsSFDetails.h"
+#include "VBoxVMSettingsSerial.h"
+#include "VBoxVMSettingsSystem.h"
+#include "VBoxVMSettingsUSB.h"
+#include "VBoxVMSettingsUSBFilterDetails.h"
+
+#ifdef Q_WS_X11
+# undef BOOL /* typedef CARD8 BOOL in Xmd.h conflicts with #define BOOL PRBool
+              * in COMDefs.h. A better fix would be to isolate X11-specific
+              * stuff by placing XX* helpers below to a separate source file. */
+RT_C_DECLS_BEGIN                        /* rhel3 build hack */
+/** @todo stuff might be missing here... */
+# include <X11/X.h>
+# include <X11/Xmd.h>
+# include <X11/Xlib.h>
+# include <X11/Xatom.h>
+# include <X11/extensions/dpms.h>
+RT_C_DECLS_END                          /* rhel3 build hack */
+# define BOOL PRBool
+# include "VBoxX11Helper.h"
+# include "XKeyboard.h"
+#endif
+
+#ifdef Q_WS_MAC
+# include <ApplicationServices/ApplicationServices.h>
+#endif
+
+#if defined (Q_WS_WIN)
+# include <shlobj.h>
+#endif
+
+#include <math.h>
+
+#include <iprt/asm.h>
+#include <iprt/assert.h>
+#include <iprt/buildconfig.h>
+#include <iprt/env.h>
+#include <iprt/err.h>
+#include <iprt/file.h>
+#include <iprt/initterm.h>
+#include <iprt/ldr.h>
+#include <iprt/log.h>
+#include <iprt/mem.h>
+#include <iprt/param.h>
+#include <iprt/path.h>
+#include <iprt/process.h>
+#include <iprt/semaphore.h>
+#include <iprt/stream.h>
+#include <iprt/system.h>
+#include <iprt/time.h>
+#include <iprt/thread.h>
+
+#include <VBox/err.h>
+#include <VBox/param.h>
+#include <VBox/sup.h>
+#include <VBox/com/Guid.h>              /* ...a bit expensive... */
+#include <VBox/VMMDev.h>                /** @todo @bugref{4084} */
+#include <VBox/VBoxHDD.h>
+#include <VBox/VBoxGL2D.h>
+#ifdef VBOX_WITH_VIDEOHWACCEL
+# include <VBox/VBoxVideo.h>
+# include <VBox/ssm.h>
+#endif
+
+#ifdef Q_WS_MAC
+# if MAC_LEOPARD_STYLE /* This is defined by VBoxDefs.h and must come after it was included */
+#  include <qmacstyle_mac.h>
+# endif
+#endif
+
