phonebookui/pbkcommonui/src/cntviewnavigator.cpp
changeset 59 a642906a277a
parent 27 de1630741fbe
child 61 d30183af6ca6
equal deleted inserted replaced
47:7cbcb2896f0e 59:a642906a277a
    45         }
    45         }
    46     }
    46     }
    47     iViewStack.push( aId );
    47     iViewStack.push( aId );
    48 }
    48 }
    49 
    49 
    50 const int& CntViewNavigator::back( QFlags<Hb::ViewSwitchFlag> &flags )
    50 const int& CntViewNavigator::back( QFlags<Hb::ViewSwitchFlag> &flags, bool toRoot )
    51 {
    51 {
    52     qDebug() << "CntViewNavigator::back() - IN";
    52     qDebug() << "CntViewNavigator::back() - IN";
    53     iTop = noView;
    53     iTop = noView;
    54     // Check if exception is set for current view item. Exception
    54     // Check if exception is set for current view item. Exception
    55     // means that instead of one step back, we go back until that 
    55     // means that instead of one step back, we go back until that 
    57     // their history will be eared.
    57     // their history will be eared.
    58     if ( !iViewStack.isEmpty() ) 
    58     if ( !iViewStack.isEmpty() ) 
    59     {
    59     {
    60         int top = iViewStack.top();
    60         int top = iViewStack.top();
    61         
    61         
       
    62         // If we need to go to the latest root view
       
    63         if ( toRoot )
       
    64         {
       
    65             while ( !iViewStack.isEmpty() ) 
       
    66             {
       
    67                 int current = iViewStack.top();
       
    68                 
       
    69                 if ( iRoots.contains( current ) )
       
    70                 {
       
    71                     iTop = current;
       
    72                     break;
       
    73                 }
       
    74                 iViewStack.pop();
       
    75             }
       
    76         }
    62         // If any exception defined for the current (top) view
    77         // If any exception defined for the current (top) view
    63         if ( iExceptions.contains( top ) ) 
    78         else if ( iExceptions.contains( top ) ) 
    64         {
    79         {
    65             iTop = iExceptions.value( top );
    80             iTop = iExceptions.value( top );
    66             // cleanup the history until the exception value is found
    81             // cleanup the history until the exception value is found
    67             while ( !iViewStack.isEmpty() ) 
    82             while ( !iViewStack.isEmpty() ) 
    68             {
    83             {
   120     if ( iEffects.contains(aCurrent) )
   135     if ( iEffects.contains(aCurrent) )
   121     {
   136     {
   122         iEffects.remove( aCurrent );
   137         iEffects.remove( aCurrent );
   123     }
   138     }
   124 }
   139 }
       
   140 
       
   141 void CntViewNavigator::addRoot( const int& aCurrent )
       
   142 {
       
   143     iRoots.append( aCurrent );
       
   144 }
   125     
   145     
   126 // End of File
   146 // End of File