phonebookui/pbkcommonui/src/cntviewnavigator.cpp
changeset 53 e6aff7b69165
parent 27 de1630741fbe
child 61 d30183af6ca6
--- a/phonebookui/pbkcommonui/src/cntviewnavigator.cpp	Wed Jul 21 11:37:51 2010 +0300
+++ b/phonebookui/pbkcommonui/src/cntviewnavigator.cpp	Fri Jul 23 12:43:48 2010 +0300
@@ -47,7 +47,7 @@
     iViewStack.push( aId );
 }
 
-const int& CntViewNavigator::back( QFlags<Hb::ViewSwitchFlag> &flags )
+const int& CntViewNavigator::back( QFlags<Hb::ViewSwitchFlag> &flags, bool toRoot )
 {
     qDebug() << "CntViewNavigator::back() - IN";
     iTop = noView;
@@ -59,8 +59,23 @@
     {
         int top = iViewStack.top();
         
+        // If we need to go to the latest root view
+        if ( toRoot )
+        {
+            while ( !iViewStack.isEmpty() ) 
+            {
+                int current = iViewStack.top();
+                
+                if ( iRoots.contains( current ) )
+                {
+                    iTop = current;
+                    break;
+                }
+                iViewStack.pop();
+            }
+        }
         // If any exception defined for the current (top) view
-        if ( iExceptions.contains( top ) ) 
+        else if ( iExceptions.contains( top ) ) 
         {
             iTop = iExceptions.value( top );
             // cleanup the history until the exception value is found
@@ -122,5 +137,10 @@
         iEffects.remove( aCurrent );
     }
 }
+
+void CntViewNavigator::addRoot( const int& aCurrent )
+{
+    iRoots.append( aCurrent );
+}
     
 // End of File