src/gui/dialogs/qdialog.cpp
changeset 7 f7bc934e204c
parent 0 1918ee327afb
--- a/src/gui/dialogs/qdialog.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/gui/dialogs/qdialog.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)
 **
@@ -69,7 +69,6 @@
 #   include "qfontdialog.h"
 #   include "qcolordialog.h"
 #   include "qwizard.h"
-#   include "qmenubar.h"
 #endif
 
 #if defined(Q_WS_S60)
@@ -265,6 +264,14 @@
     if (!qt_wince_is_smartphone())
         setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint));
 #endif
+
+#ifdef Q_WS_S60
+    if (S60->avkonComponentsSupportTransparency) {
+        bool noSystemBackground = testAttribute(Qt::WA_NoSystemBackground);
+        setAttribute(Qt::WA_TranslucentBackground); // also sets WA_NoSystemBackground
+        setAttribute(Qt::WA_NoSystemBackground, noSystemBackground); // restore system background attribute
+    }
+#endif
 }
 
 #ifdef QT3_SUPPORT
@@ -294,6 +301,14 @@
     if (!qt_wince_is_smartphone())
         setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint));
 #endif
+
+#ifdef Q_WS_S60
+    if (S60->avkonComponentsSupportTransparency) {
+        bool noSystemBackground = testAttribute(Qt::WA_NoSystemBackground);
+        setAttribute(Qt::WA_TranslucentBackground); // also sets WA_NoSystemBackground
+        setAttribute(Qt::WA_NoSystemBackground, noSystemBackground); // restore system background attribute
+    }
+#endif
 }
 
 /*!
@@ -399,8 +414,15 @@
         result = true;
      }
 #else
-    if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize ))
-        adjustPosition(parentWidget());
+    if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) {
+        if (!testAttribute(Qt::WA_Moved)) {
+            Qt::WindowStates state = windowState();
+            adjustPosition(parentWidget());
+            setAttribute(Qt::WA_Moved, false); // not really an explicit position
+            if (state != windowState())
+                setWindowState(state);
+        }
+    }
 #endif
     return result;
 }
@@ -506,12 +528,6 @@
 #endif //Q_WS_WINCE_WM
 
 #ifdef Q_OS_SYMBIAN
-#ifndef QT_NO_MENUBAR
-    QMenuBar *menuBar = 0;
-    if (!findChild<QMenuBar *>())
-        menuBar = new QMenuBar(this);
-#endif
-
     if (qobject_cast<QFileDialog *>(this) || qobject_cast<QFontDialog *>(this) ||
         qobject_cast<QColorDialog *>(this) || qobject_cast<QWizard *>(this))
         showMaximized();
@@ -543,13 +559,6 @@
         delete menuBar;
 #endif //QT_NO_MENUBAR
 #endif //Q_WS_WINCE_WM
-#ifdef Q_OS_SYMBIAN
-#ifndef QT_NO_MENUBAR
-    else if (menuBar)
-        delete menuBar;
-#endif //QT_NO_MENUBAR
-#endif //Q_OS_SYMBIAN
-
     return res;
 }
 
@@ -791,11 +800,11 @@
 void QDialog::showEvent(QShowEvent *event)
 {
     if (!event->spontaneous() && !testAttribute(Qt::WA_Moved)) {
-	Qt::WindowStates  state = windowState();
+        Qt::WindowStates  state = windowState();
         adjustPosition(parentWidget());
         setAttribute(Qt::WA_Moved, false); // not really an explicit position
-	if (state != windowState())
-	    setWindowState(state);
+        if (state != windowState())
+            setWindowState(state);
     }
 }
 
@@ -888,7 +897,14 @@
     if (doS60Positioning) {
         // naive way to deduce screen orientation
         if (S60->screenHeightInPixels > S60->screenWidthInPixels) {
-            p.setY(S60->screenHeightInPixels-height()-qt_TSize2QSize(S60->buttonGroupContainer()->Size()).height());
+            int cbaHeight;
+            const CEikButtonGroupContainer* bgContainer = S60->buttonGroupContainer();
+            if (!bgContainer) {
+                cbaHeight = 0;
+            } else {
+                cbaHeight = qt_TSize2QSize(bgContainer->Size()).height();
+            }
+            p.setY(S60->screenHeightInPixels-height()-cbaHeight);
             p.setX(0);
         } else {
             const int scrollbarWidth = style()->pixelMetric(QStyle::PM_ScrollBarExtent);