browserui/browser/FavouritesSrc/BrowserFavouritesView.cpp
branchRCL_3
changeset 43 b149f0820e5a
parent 36 c9249d037530
child 45 5a044f6358c2
equal deleted inserted replaced
41:aead3f7e1bb0 43:b149f0820e5a
    17 *
    17 *
    18 */
    18 */
    19 
    19 
    20 
    20 
    21 // INCLUDE FILES
    21 // INCLUDE FILES
       
    22 #include <aknappui.h>
       
    23 #include <akntitle.h>
       
    24 #include <eikenv.h>
       
    25 #include <eikspane.h>
       
    26 
    22 #include <aknsfld.h>
    27 #include <aknsfld.h>
    23 #include <eikbtgpc.h>
    28 #include <eikbtgpc.h>
    24 #include <eikmenub.h>
    29 #include <eikmenub.h>
    25 #include <aknviewappui.h>
    30 #include <aknviewappui.h>
    26 #include <Avkon.hrh>
    31 #include <Avkon.hrh>
   256     BaseConstructL( aViewResourceId );
   261     BaseConstructL( aViewResourceId );
   257     iModel = CreateModelL();
   262     iModel = CreateModelL();
   258     iInitialFolder = iCurrentFolder;
   263     iInitialFolder = iCurrentFolder;
   259     // Ap model cannot be created without opening it; so that's not done here.
   264     // Ap model cannot be created without opening it; so that's not done here.
   260     // DoActivateL / DoDecativateL does that.
   265     // DoActivateL / DoDecativateL does that.
       
   266     Cba()->MakeVisible(EFalse); // avoid multiple redraws
   261     }
   267     }
   262 
   268 
   263 // ---------------------------------------------------------
   269 // ---------------------------------------------------------
   264 // CBrowserFavouritesView::GetItemsLC
   270 // CBrowserFavouritesView::GetItemsLC
   265 // ---------------------------------------------------------
   271 // ---------------------------------------------------------
   457                         const TDesC8& /*aCustomMessage*/ )
   463                         const TDesC8& /*aCustomMessage*/ )
   458     {
   464     {
   459     iPreviousViewID = ApiProvider().LastActiveViewId( );
   465     iPreviousViewID = ApiProvider().LastActiveViewId( );
   460     ApiProvider().SetLastActiveViewId( Id() );
   466     ApiProvider().SetLastActiveViewId( Id() );
   461     ApiProvider().CommsModel().AddObserverL( *this );
   467     ApiProvider().CommsModel().AddObserverL( *this );
   462     iContainer = CreateContainerL();
   468     iContainer = CreateContainerL(); // can this be created during construct ?
   463     iModel->AddObserverL( *this );
   469     iModel->AddObserverL( *this );
   464     AppUi()->AddToViewStackL( *this, iContainer );
   470     AppUi()->AddToViewStackL( *this, iContainer );
   465 
   471 
   466     ApiProvider().StartProgressAnimationL();
   472     ApiProvider().StartProgressAnimationL();
   467 
   473 
   487                 }
   493                 }
   488             iContainer->Listbox()->SetCurrentItemIndex( iLastSelection );
   494             iContainer->Listbox()->SetCurrentItemIndex( iLastSelection );
   489             }
   495             }
   490 
   496 
   491         iContainer->Listbox()->View()->SetDisableRedraw( redrawDisabled );
   497         iContainer->Listbox()->View()->SetDisableRedraw( redrawDisabled );
   492         iContainer->Listbox()->DrawNow();
   498         iContainer->Listbox()->DrawDeferred();
   493         }
   499         }
   494     else
   500     else
   495         {
   501         {
   496         // No folder is opened; update CBA and Navi Pane now.
   502         // No folder is opened; update CBA and Navi Pane now.
   497         if ( iLastSelection >=0 )
   503         if ( iLastSelection >=0 )
   507         {
   513         {
   508         iContainer->Listbox()->SetStateL(*iSavedListboxState);
   514         iContainer->Listbox()->SetStateL(*iSavedListboxState);
   509         }
   515         }
   510     iIsActivated = ETrue;
   516     iIsActivated = ETrue;
   511     
   517     
   512     PERFLOG_STOPWATCH_START;
   518 #ifndef BRDO_PERF_IMPROVEMENTS_ENABLED_FF
       
   519     // TODO: Remove this crapy refresh once favicon callback interface
       
   520     // with engine is implemented. 
   513     if(!iFavViewRefresh)
   521     if(!iFavViewRefresh)
   514          iFavViewRefresh  = CIdle::NewL( CActive::EPriorityIdle );
   522          iFavViewRefresh  = CIdle::NewL( CActive::EPriorityIdle );
   515     iFavViewRefresh ->Start( TCallBack( RefeshFavoriteListBox, this ) );
   523     iFavViewRefresh ->Start( TCallBack( RefeshFavoriteListBox, this ) );
   516     PERFLOG_STOP_WRITE("\t Favourite view NewL");
   524 #endif    
   517     }
   525     }
   518 
   526 
   519 
   527 
   520 TInt CBrowserFavouritesView::RefeshFavoriteListBox(TAny* aFavouritesView)
   528 TInt CBrowserFavouritesView::RefeshFavoriteListBox(TAny* aFavouritesView)
   521     {
   529     {
  1104         iContainer->Listbox()->GetDefaultData().iInSeamlessFolder = EFalse;
  1112         iContainer->Listbox()->GetDefaultData().iInSeamlessFolder = EFalse;
  1105         // Set title.
  1113         // Set title.
  1106         if ( aFolder == KFavouritesRootUid )
  1114         if ( aFolder == KFavouritesRootUid )
  1107             {
  1115             {
  1108             UpdateNaviPaneL(); // remove NaviPane before setting title - SetTitleL redraws
  1116             UpdateNaviPaneL(); // remove NaviPane before setting title - SetTitleL redraws
  1109             ApiProvider().Display().SetTitleL( RootTitleResourceId() );
  1117             if(ApiProvider().StartedUp())
       
  1118                 ApiProvider().Display().SetTitleL( RootTitleResourceId() );
       
  1119             else
       
  1120                 {
       
  1121                 // Set title to be page title
       
  1122                 CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, CEikonEnv::Static()->EikAppUi() )->StatusPane();
       
  1123                 CAknTitlePane* title = STATIC_CAST( CAknTitlePane*, sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
  1124                 HBufC* name = CEikonEnv::Static()->AllocReadResourceLC( R_BROWSER_OPTION_BOOKMARKS );
       
  1125                 title->SetTextL( *name );            
       
  1126                 CleanupStack::PopAndDestroy();   // name
       
  1127                 }
  1110             }
  1128             }
  1111         else
  1129         else
  1112             {
  1130             {
  1113             // Next get localized title text if the folder is a seamless link folder.
  1131             // Next get localized title text if the folder is a seamless link folder.
  1114             TInt resId = CBrowserFavouritesView::GetSeamlessFolderTitleResourceID(
  1132             TInt resId = CBrowserFavouritesView::GetSeamlessFolderTitleResourceID(
  1130             }
  1148             }
  1131 
  1149 
  1132         iCurrentFolder = aFolder;
  1150         iCurrentFolder = aFolder;
  1133         FillListboxL( aFolder, /*aKeepState=*/EFalse );
  1151         FillListboxL( aFolder, /*aKeepState=*/EFalse );
  1134                 
  1152                 
  1135         Container()->Listbox()->ClearSelection();
  1153         Container()->Listbox()->ClearSelection(); // is it needed ?
  1136         UpdateCbaL();
  1154         UpdateCbaL();
  1137         UpdateNaviPaneL();
  1155         UpdateNaviPaneL();
  1138         }
  1156         }
  1139     CleanupStack::PopAndDestroy();  // folder
  1157     CleanupStack::PopAndDestroy();  // folder
  1140     }
  1158     }
  1294     else
  1312     else
  1295         {
  1313         {
  1296         aknview->SetFindEmptyListState(ETrue);
  1314         aknview->SetFindEmptyListState(ETrue);
  1297         }
  1315         }
  1298 
  1316 
  1299     iContainer->SizeChanged();  // Needed to show/hide Find Pane!
  1317     if(ApiProvider().StartedUp())
       
  1318     	iContainer->SizeChanged();  // Needed to show/hide Find Pane!
  1300     iCurrentFolder = aFolder;
  1319     iCurrentFolder = aFolder;
  1301 
  1320 
  1302     HighlightPreferredL();
  1321     HighlightPreferredL();
  1303     iContainer->HandleCursorChangedL( listbox );
  1322     iContainer->HandleCursorChangedL( listbox );
  1304     listbox->View()->SetDisableRedraw( redrawDisabled );
  1323     listbox->View()->SetDisableRedraw( redrawDisabled );
  1305     listbox->DrawNow();
  1324     
  1306     UpdateCbaL();
  1325     if(ApiProvider().StartedUp())
  1307     UpdateNaviPaneL();
  1326         {
       
  1327         listbox->DrawDeferred();
       
  1328         UpdateCbaL();
       
  1329         UpdateNaviPaneL();
       
  1330         }
  1308     }
  1331     }
  1309 
  1332 
  1310 // ----------------------------------------------------------------------------
  1333 // ----------------------------------------------------------------------------
  1311 // CBrowserFavouritesView::ConfirmDeleteL
  1334 // CBrowserFavouritesView::ConfirmDeleteL
  1312 // ----------------------------------------------------------------------------
  1335 // ----------------------------------------------------------------------------