From 904d205b8d69b341aa8f25dbb7a7871e6f56c2ef Mon Sep 17 00:00:00 2001
From: Jason Barron <jbarron@trolltech.com>
Date: Tue, 20 Apr 2010 10:09:00 +0200
Subject: Use QDesktopWidget as a status pane observer on Symbian.

Now that the S60 screen furniture construction is delayed, we need to
manually set the status pane observer to get notifications about
changes in the size of the status pane. Using the AppUi would have been
the obvious choice here, but sadly CAknAppUi (base class for
QS60MainAppUi) uses private inheritance when implementing the
MEikStatusPaneObserver interface.

To work around this problem we make QSymbianControl implement the
interface and use the instance of this class that is associated with
QDesktopWidget to recevive the notifications and then call the function
in the AppUi to maintain the same behavior.

Reviewed-by: Janne Anttila
Reviewed-by: mread
---
 src/gui/kernel/qapplication_s60.cpp | 8 ++++++++
 src/gui/kernel/qt_s60_p.h           | 3 ++-
 src/gui/kernel/qwidget_s60.cpp      | 5 +++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 41ae294..d87cf5f 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -540,6 +540,14 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
     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,
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index a714221..58da302 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -155,7 +155,7 @@ class QLongTapTimer;
 
 class QSymbianControl : public CCoeControl, public QAbstractLongTapObserver
 #ifdef Q_WS_S60
-, public MAknFadedComponent
+, public MAknFadedComponent, public MEikStatusPaneObserver
 #endif
 {
 public:
@@ -183,6 +183,7 @@ public:
 
 #ifdef Q_WS_S60
     void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); }
+    void HandleStatusPaneSizeChange();
 
 protected: // from MAknFadedComponent
     TInt CountFadedComponents() {return 1;}
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 5db6e70..cae38f5 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -508,6 +508,11 @@ void QWidgetPrivate::show_sys()
                     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.
-- 
cgit v0.12