src/gui/dialogs/qmessagebox.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
--- a/src/gui/dialogs/qmessagebox.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/gui/dialogs/qmessagebox.cpp	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -58,12 +58,17 @@
 #include <QtGui/qtextdocument.h>
 #include <QtGui/qapplication.h>
 #include <QtGui/qtextedit.h>
+#include <QtGui/qtextbrowser.h>
 #include <QtGui/qmenu.h>
 #include "qdialog_p.h"
 #include <QtGui/qfont.h>
 #include <QtGui/qfontmetrics.h>
 #include <QtGui/qclipboard.h>
 
+#ifndef QT_NO_STYLE_S60
+#include <qs60style.h>
+#endif
+
 #ifdef Q_WS_WINCE
 extern bool qt_wince_is_mobile();    //defined in qguifunctions_wince.cpp
 extern bool qt_wince_is_smartphone();//defined in qguifunctions_wince.cpp
@@ -188,8 +193,8 @@
     bool autoAddOkButton;
     QAbstractButton *detectedEscapeButton;
     QLabel *informativeLabel;
-#ifdef Q_OS_SYMBIAN
-    QTextEdit *textEdit;
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
+    QTextBrowser *textBrowser;
 #endif
     QPointer<QObject> receiverToDisconnectOnClose;
     QByteArray memberToDisconnectOnClose;
@@ -313,6 +318,7 @@
             }
             width = hardLimit;
         }
+    }
 #ifdef Q_WS_S60
         // in S60 portait messageBoxes should always occupy maximum width
         if (QApplication::desktop()->size().height() > QApplication::desktop()->size().width()){
@@ -322,7 +328,6 @@
             width = qMin(QApplication::desktop()->size().height(), hardLimit);
         }
 #endif
-    }
 
     if (informativeLabel) {
         label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
@@ -352,6 +357,16 @@
     int height = (layout->hasHeightForWidth())
                      ? layout->totalHeightForWidth(width)
                      : layout->totalMinimumSize().height();
+
+#ifndef QT_NO_STYLE_S60
+        QS60Style *s60Style = 0;
+        s60Style = qobject_cast<QS60Style *>(QApplication::style());
+
+        //use custom pixel metric to deduce the minimum height of the messagebox
+        if (s60Style)
+            height = qMax(height, s60Style->pixelMetric((QStyle::PixelMetric)PM_MessageBoxHeight));
+#endif
+
     q->setFixedSize(width, height);
     QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest);
 }
@@ -1726,7 +1741,7 @@
         "to comply with the terms of the GNU GPL version 3.0.</p>"
         "<p>Please see <a href=\"http://qt.nokia.com/products/licensing\">qt.nokia.com/products/licensing</a> "
         "for an overview of Qt licensing.</p>"
-        "<p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p>"
+        "<p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p>"
         "<p>Qt is a Nokia product. See <a href=\"http://qt.nokia.com/\">qt.nokia.com</a> "
         "for more information.</p>"
         );
@@ -2462,12 +2477,12 @@
 #endif
         label->setWordWrap(true);
         QGridLayout *grid = static_cast<QGridLayout *>(layout());
-#ifdef Q_OS_SYMBIAN
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
         label->hide();
-        QTextEdit *textEdit = new QTextEdit(this);
-        textEdit->setReadOnly(true);
-        grid->addWidget(textEdit, 1, 1, 1, 1);
-        d->textEdit = textEdit;
+        QTextBrowser *textBrowser = new QTextBrowser(this);
+        textBrowser->setOpenExternalLinks(true);
+        grid->addWidget(textBrowser, 1, 1, 1, 1);
+        d->textBrowser = textBrowser;
 #else
         grid->addWidget(label, 1, 1, 1, 1);
 #endif
@@ -2475,9 +2490,9 @@
     }
     d->informativeLabel->setText(text);
 
-#ifdef Q_OS_SYMBIAN
-    //We need to put the informative label inside textEdit to enable scrolling of long texts.
-    d->textEdit->setText(d->informativeLabel->text());
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
+    //We need to put the informative label inside textBrowser to enable scrolling of long texts.
+    d->textBrowser->setText(d->informativeLabel->text());
 #endif
 
     d->updateSize();