src/hbcore/gui/hbview.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
--- a/src/hbcore/gui/hbview.cpp	Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbcore/gui/hbview.cpp	Mon Oct 04 00:38:12 2010 +0300
@@ -38,6 +38,7 @@
 #include "hbscreen_p.h"
 #include "hbviewactionmanager_p.h"
 #include "hbglobal_p.h"
+#include "hbevent.h"
 #include <QPointer>
 
 /*!
@@ -740,11 +741,12 @@
     HbView::HbViewFlags originalFlags(d->mViewFlags);
     d->mViewFlags = flags;
     if (mainWindow()) {
-
-        // Statusbar-animation
-        bool statusBarAnimating = false;
-        HbStatusBar *statusBar = HbMainWindowPrivate::d_ptr(mainWindow())->mStatusBar;
-        if ((d->mViewFlags & HbView::ViewStatusBarHidden) && !(originalFlags & HbView::ViewStatusBarHidden)) {
+        bool isCurrentView(mainWindow()->currentView() == this);
+        if (isCurrentView) {
+            // Statusbar-animation
+            bool statusBarAnimating = false;
+            HbStatusBar *statusBar = HbMainWindowPrivate::d_ptr(mainWindow())->mStatusBar;
+            if ((d->mViewFlags & HbView::ViewStatusBarHidden) && !(originalFlags & HbView::ViewStatusBarHidden)) {
 #ifdef HB_EFFECTS
             HbEffect::start(statusBar, "statusbar", "disappear", this, "statusBarEffectFinished");
 #endif // HB_EFFECTS
@@ -755,36 +757,37 @@
             HbEffect::start(statusBar, "statusbar", "appear", this, "statusBarEffectFinished");
 #endif // HB_EFFECTS
             statusBarAnimating = true;
-        }
+            }
 
-        // Titlebar-animation
-        bool titleBarAnimating = false;
-        HbTitleBar *titleBar = HbMainWindowPrivate::d_ptr(mainWindow())->mTitleBar;
-        if ((d->mViewFlags & HbView::ViewTitleBarHidden) && !(originalFlags & HbView::ViewTitleBarHidden)) {
+            // Titlebar-animation
+            bool titleBarAnimating = false;
+            HbTitleBar *titleBar = HbMainWindowPrivate::d_ptr(mainWindow())->mTitleBar;
+            if ((d->mViewFlags & HbView::ViewTitleBarHidden) && !(originalFlags & HbView::ViewTitleBarHidden)) {
 #ifdef HB_EFFECTS
-            HbEffect::start(titleBar, "titlebar", "disappear", this, "titleBarEffectFinished");
+                HbEffect::start(titleBar, "titlebar", "disappear", this, "titleBarEffectFinished");
 #endif // HB_EFFECTS
-            titleBarAnimating = true;
-        } else if (!(d->mViewFlags & HbView::ViewTitleBarHidden) && (originalFlags & HbView::ViewTitleBarHidden)) {
+                titleBarAnimating = true;
+            } else if (!(d->mViewFlags & HbView::ViewTitleBarHidden) && (originalFlags & HbView::ViewTitleBarHidden)) {
 #ifdef HB_EFFECTS
-            titleBar->setVisible(true);
-            HbEffect::start(titleBar, "titlebar", "appear", this, "titleBarEffectFinished");
+                titleBar->setVisible(true);
+                HbEffect::start(titleBar, "titlebar", "appear", this, "titleBarEffectFinished");
 #endif // HB_EFFECTS
-            titleBarAnimating = true;
-        }
+                titleBarAnimating = true;
+            }
 
-        if (!statusBarAnimating && !titleBarAnimating) {
-            statusBar->setVisible(!(d->mViewFlags & HbView::ViewStatusBarHidden));
-            statusBar->propertiesChanged();
-        }
-        if (!titleBarAnimating && !statusBarAnimating) {
-            titleBar->setVisible(!(d->mViewFlags & HbView::ViewTitleBarHidden));
-            if (d->mNavigationActionSet) {
-                titleBar->setNavigationAction(d->mNavigationAction);
-            } else {
-                titleBar->setDefaultNavigationAction();
+            if (!statusBarAnimating && !titleBarAnimating) {
+                statusBar->setVisible(!(d->mViewFlags & HbView::ViewStatusBarHidden));
+                statusBar->propertiesChanged();
             }
-            titleBar->propertiesChanged();
+            if (!titleBarAnimating && !statusBarAnimating) {
+                titleBar->setVisible(!(d->mViewFlags & HbView::ViewTitleBarHidden));
+                if (d->mNavigationActionSet) {
+                    titleBar->setNavigationAction(d->mNavigationAction);
+                } else {
+                    titleBar->setDefaultNavigationAction();
+                }
+                titleBar->propertiesChanged();
+            }
         }
         if (d->toolBar) {
             d->toolBar->updatePrimitives();
@@ -812,7 +815,7 @@
         int visibilityFlags = HbView::ViewTitleBarMinimized | HbView::ViewTitleBarFloating
                               | HbView::ViewTitleBarMinimizable | HbView::ViewStatusBarHidden | HbView::ViewStatusBarFloating
                               | HbView::ViewTitleBarHidden | HbView::ViewDisableRelayout;
-        if ((d->mViewFlags & visibilityFlags) != (originalFlags & visibilityFlags)) {
+        if (isCurrentView && (d->mViewFlags & visibilityFlags) != (originalFlags & visibilityFlags)) {
             HbMainWindowPrivate::d_ptr(mainWindow())->mClippingItem->decoratorVisibilityChanged();
         }
     }
@@ -911,6 +914,7 @@
  */
 void HbView::changeEvent(QEvent *event)
 {
+    Q_D(const HbView);
 
     // We're listening for layout direction changes, because the screen needs to be
     // repolished, if the layout direction changes and the titlebar is minimizable.
@@ -923,6 +927,11 @@
         if (mw && mw->currentView() == this) {
             HbMainWindowPrivate::d_ptr(mw)->mClippingItem->decoratorVisibilityChanged();
         }
+    } else if(event->type() == HbEvent::ThemeChanged) {
+        HbMainWindow *mw = mainWindow();
+        if (d->toolBar && mw && mw->currentView() != this) {
+            d->toolBar->changeEvent(event);
+        }
     }
 
     HbWidget::changeEvent(event);