qtinternetradio/ui/src/irviewmanager.cpp
changeset 5 0930554dc389
parent 3 ee64f059b8e1
child 12 608f67c22514
--- a/qtinternetradio/ui/src/irviewmanager.cpp	Fri May 14 15:43:29 2010 +0300
+++ b/qtinternetradio/ui/src/irviewmanager.cpp	Thu May 27 12:46:34 2010 +0300
@@ -124,6 +124,38 @@
     return NULL;
 }
 
+TIRViewId IRViewManager::getExitingView()
+{
+    if(0 == views().count())
+    {
+        return EIRView_InvalidId;
+    }
+    else
+    {
+        IRBaseView* lastView = static_cast<IRBaseView*>(currentView());
+        if(lastView->testFlag(IRBaseView::EViewFlag_StickyViewEnabled))
+        {
+            return lastView->id();
+        }
+        
+        if(iViewStack.empty())
+        {
+            return EIRView_InvalidId;
+        }
+        
+        for(int i = iViewStack.size()-1; i >= 0 ; i--)
+        {
+            IRBaseView* lastView = iViewStack.at(i);
+            if(lastView->testFlag(IRBaseView::EViewFlag_StickyViewEnabled))
+            {
+                return lastView->id();
+            }
+        }    
+ 
+        return EIRView_InvalidId;
+    }
+}
+
 /*
  * Description : Judge if a view is in the view stack.
  * Parameters  : aViewId : the view's id
@@ -176,14 +208,14 @@
     
     if (view)
     {
-        if (EViewFlag_ClearStackWhenActivate == view->flag())
+        if (view->testFlag(IRBaseView::EViewFlag_ClearStackWhenActivate))
         {
             clearStack();
         }
         else
         {    if (aPushCurrentView)
              {
-                 if (baseView && EViewFlag_UnStackable != baseView->flag())
+                 if (baseView && !baseView->testFlag(IRBaseView::EViewFlag_UnStackable))
                  {
                      iViewStack.push(baseView);
                  }
@@ -448,7 +480,7 @@
     IRBaseView *topView = static_cast<IRBaseView*>(currentView());
     if (topView)
     {
-        if (EViewFlag_ClearStackWhenActivate == topView->flag())
+        if (topView->testFlag(IRBaseView::EViewFlag_ClearStackWhenActivate))
         {
             topView->setNavigationAction(iExitAction);
         }