3a438a6e0b41f1ef657ef0e648d352db636204aa RCL_3
authorEckhart Koeppen <eckhart.koppen@nokia.com>
Wed, 21 Apr 2010 11:15:19 +0300
branchRCL_3
changeset 12 25a739ee40f4
parent 11 68d3b337861b
child 13 cc75c76972ee
3a438a6e0b41f1ef657ef0e648d352db636204aa
VERSION.SHA1
src/gui/kernel/qapplication_s60.cpp
src/gui/kernel/qsoftkeymanager_s60.cpp
src/gui/kernel/qt_s60_p.h
src/gui/kernel/qwidget_s60.cpp
src/gui/s60framework/qs60mainappui.cpp
--- a/VERSION.SHA1	Wed Apr 21 09:15:16 2010 +0300
+++ b/VERSION.SHA1	Wed Apr 21 11:15:19 2010 +0300
@@ -1,1 +1,1 @@
-bac24638cd0e032feaaaf81f375284a059242729
+3a438a6e0b41f1ef657ef0e648d352db636204aa
--- a/src/gui/kernel/qapplication_s60.cpp	Wed Apr 21 09:15:16 2010 +0300
+++ b/src/gui/kernel/qapplication_s60.cpp	Wed Apr 21 11:15:19 2010 +0300
@@ -73,6 +73,7 @@
 # endif
 # include <private/qs60mainapplication_p.h>
 # include <centralrepository.h>
+# include "qs60mainappui.h"
 #endif
 
 #include "private/qstylesheetstyle_p.h"
@@ -534,6 +535,14 @@
     sendMouseEvent(receiver, type, globalPos, button, modifiers);
 }
 
+#ifdef Q_WS_S60
+void QSymbianControl::HandleStatusPaneSizeChange()
+{
+    QS60MainAppUi *s60AppUi = static_cast<QS60MainAppUi *>(S60->appUi());
+    s60AppUi->HandleStatusPaneSizeChange();
+}
+#endif
+
 void QSymbianControl::sendMouseEvent(
         QWidget *receiver,
         QEvent::Type type,
--- a/src/gui/kernel/qsoftkeymanager_s60.cpp	Wed Apr 21 09:15:16 2010 +0300
+++ b/src/gui/kernel/qsoftkeymanager_s60.cpp	Wed Apr 21 11:15:19 2010 +0300
@@ -78,6 +78,8 @@
     // Note: Cannot use IsDisplayingMenuOrDialog since CBA update can be triggered before
     // menu/dialog CBA is actually displayed i.e. it is being costructed.
     CEikButtonGroupContainer *appUiCba = S60->buttonGroupContainer();
+    if (!appUiCba)
+        return true;
     // CEikButtonGroupContainer::Current returns 0 if CBA is not visible at all
     CEikButtonGroupContainer *currentCba = CEikButtonGroupContainer::Current();
     // Check if softkey need to be update even they are not visible
--- a/src/gui/kernel/qt_s60_p.h	Wed Apr 21 09:15:16 2010 +0300
+++ b/src/gui/kernel/qt_s60_p.h	Wed Apr 21 11:15:19 2010 +0300
@@ -154,7 +154,7 @@
 
 class QSymbianControl : public CCoeControl, public QAbstractLongTapObserver
 #ifdef Q_WS_S60
-, public MAknFadedComponent
+, public MAknFadedComponent, public MEikStatusPaneObserver
 #endif
 {
 public:
@@ -182,6 +182,7 @@
 
 #ifdef Q_WS_S60
     void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); }
+    void HandleStatusPaneSizeChange();
 
 protected: // from MAknFadedComponent
     TInt CountFadedComponents() {return 1;}
--- a/src/gui/kernel/qwidget_s60.cpp	Wed Apr 21 09:15:16 2010 +0300
+++ b/src/gui/kernel/qwidget_s60.cpp	Wed Apr 21 11:15:19 2010 +0300
@@ -387,16 +387,7 @@
                 | EPointerFilterMove | EPointerFilterDrag, 0);
             drawableWindow->EnableVisibilityChangeEvents();
 
-            if (!isOpaque) {
-                RWindow *const window = static_cast<RWindow *>(drawableWindow);
-#ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE
-                window->SetSurfaceTransparency(true);
-#else
-                const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
-                if (window->SetTransparencyAlphaChannel() == KErrNone)
-                    window->SetBackgroundColor(TRgb(255, 255, 255, 0));
-#endif
-            }
+            s60UpdateIsOpaque();
         }
 
         q->setAttribute(Qt::WA_WState_Created);
@@ -488,6 +479,47 @@
 
          QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
 
+#ifdef Q_WS_S60
+        // Lazily initialize the S60 screen furniture when the first window is shown.
+        if (!QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)
+                && !S60->buttonGroupContainer() && !S60->statusPane()) {
+
+            bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
+            bool cbaRequested = q->windowFlags() & Qt::WindowSoftkeysVisibleHint;
+
+            // If the window is fullscreen and has not explicitly requested that the CBA be visible
+            // we delay the creation even more.
+            if ((!isFullscreen || cbaRequested) && !q->testAttribute(Qt::WA_DontShowOnScreen)) {
+
+                // Create the status pane and CBA here
+                CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi());
+                MEikAppUiFactory *factory = CEikonEnv::Static()->AppUiFactory();
+                TRAP_IGNORE(factory->ReadAppInfoResourceL(0, ui));
+                if (S60->buttonGroupContainer())
+                    S60->buttonGroupContainer()->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
+
+                if (S60->statusPane()) {
+                    // Use QDesktopWidget as the status pane observer to proxy for the AppUi.
+                    // Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver.
+                    QSymbianControl *desktopControl = static_cast<QSymbianControl *>(QApplication::desktop()->winId());
+                    S60->statusPane()->SetObserver(desktopControl);
+
+                    // Hide the status pane if fullscreen OR
+                    // Fill client area if maximized OR
+                    // Put window below status pane unless the window has an explicit position.
+                    if (isFullscreen) {
+                        S60->statusPane()->MakeVisible(false);
+                    } else if (q->windowState() & Qt::WindowMaximized) {
+                        TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+                        id->SetExtent(r.iTl, r.Size());
+                    } else if (!q->testAttribute(Qt::WA_Moved)) {
+                        id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl);
+                    }
+                }
+            }
+        }
+#endif
+
         id->MakeVisible(true);
 
         if(q->isWindow())
@@ -1063,6 +1095,9 @@
         return;
 
     if (isWindow()) {
+        createWinId();
+        Q_ASSERT(testAttribute(Qt::WA_WState_Created));
+
         const bool wasResized = testAttribute(Qt::WA_Resized);
         const bool wasMoved = testAttribute(Qt::WA_Moved);
 
@@ -1100,23 +1135,32 @@
         }
 #endif // Q_WS_S60
 
-        createWinId();
-        Q_ASSERT(testAttribute(Qt::WA_WState_Created));
         // Ensure the initial size is valid, since we store it as normalGeometry below.
         if (!wasResized && !isVisible())
             adjustSize();
 
         QTLWExtra *top = d->topData();
-        const QRect normalGeometry = (top->normalGeometry.width() < 0) ? geometry() : top->normalGeometry;
-
+        QRect normalGeometry = (top->normalGeometry.width() < 0) ? geometry() : top->normalGeometry;
 
         const bool cbaVisibilityHint = windowFlags() & Qt::WindowSoftkeysVisibleHint;
-        if (newstate & Qt::WindowFullScreen && !cbaVisibilityHint)
-            setGeometry(qApp->desktop()->screenGeometry(this));
-        else if (newstate & Qt::WindowMaximized || ((newstate & Qt::WindowFullScreen) && cbaVisibilityHint))
-            setGeometry(qApp->desktop()->availableGeometry(this));
-        else
+        if (newstate & Qt::WindowFullScreen && !cbaVisibilityHint) {
+            window->SetExtentToWholeScreen();
+        } else if (newstate & Qt::WindowMaximized || ((newstate & Qt::WindowFullScreen) && cbaVisibilityHint)) {
+            TRect maxExtent = qt_QRect2TRect(qApp->desktop()->availableGeometry(this));
+            window->SetExtent(maxExtent.iTl, maxExtent.Size());
+        } else {
+#ifdef Q_WS_S60
+            // With delayed creation of S60 app panes, the normalGeometry calculated above is not
+            // accurate because it did not consider the status pane. This means that when returning
+            // normal mode after showing the status pane, the geometry would overlap so we should
+            // move it if it never had an explicit position.
+            if (!wasMoved && statusPane && visible) {
+                TPoint tl = static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl;
+                normalGeometry.setTopLeft(QPoint(tl.iX, tl.iY));
+            }
+#endif
             setGeometry(normalGeometry);
+        }
 
         //restore normal geometry
         top->normalGeometry = normalGeometry;
--- a/src/gui/s60framework/qs60mainappui.cpp	Wed Apr 21 09:15:16 2010 +0300
+++ b/src/gui/s60framework/qs60mainappui.cpp	Wed Apr 21 11:15:19 2010 +0300
@@ -112,16 +112,10 @@
     // ENoAppResourceFile and ENonStandardResourceFile makes UI to work without
     // resource files in most SDKs. S60 3rd FP1 public seems to require resource file
     // even these flags are defined
-    TInt flags = CAknAppUi::EAknEnableSkin;
-    if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)) {
-        flags |= CAknAppUi::ENoScreenFurniture | CAknAppUi::ENonStandardResourceFile;
-    }
+    TInt flags = CAknAppUi::EAknEnableSkin
+                 | CAknAppUi::ENoScreenFurniture
+                 | CAknAppUi::ENonStandardResourceFile;
     BaseConstructL(flags);
-
-    if (!QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)) {
-        CEikButtonGroupContainer* nativeContainer = Cba();
-        nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
-    }
 }
 
 /*!