photosgallery/viewframework/views/viewbase/src/glxmedialistviewbase.cpp
branchRCL_3
changeset 9 6b87b143d312
parent 2 7d9067c6fcb1
child 30 a60acebbbd9d
equal deleted inserted replaced
5:f7f0874bfe7d 9:6b87b143d312
    19 
    19 
    20 
    20 
    21 #include "glxmedialistviewbase.h"
    21 #include "glxmedialistviewbase.h"
    22 
    22 
    23 #include <mpxcollectionutility.h>
    23 #include <mpxcollectionutility.h>
       
    24 #include <glxcollectionpluginimageviewer.hrh>
    24 #include <glxcommandhandler.h>
    25 #include <glxcommandhandler.h>
    25 #include <glxassert.h>
    26 #include <glxassert.h>
    26 #include <glxgallery.hrh>
    27 #include <glxgallery.hrh>
    27 #include <glxattributecontext.h>
    28 #include <glxattributecontext.h>
    28 #include <glxuistd.h>
    29 #include <glxuistd.h>
   162         iMediaList = &iMediaListFactory->CreateMediaListL(*iCollectionUtility);
   163         iMediaList = &iMediaListFactory->CreateMediaListL(*iCollectionUtility);
   163     	iMediaList->AddContextL(iPreloadContextForCommandHandlers, 0);
   164     	iMediaList->AddContextL(iPreloadContextForCommandHandlers, 0);
   164         }
   165         }
   165     __ASSERT_ALWAYS(iMediaList, Panic(EGlxPanicNullMediaList));
   166     __ASSERT_ALWAYS(iMediaList, Panic(EGlxPanicNullMediaList));
   166 
   167 
   167     if(iFixedTitle)
   168     
       
   169     CMPXCollectionPath* navigationalState = iCollectionUtility->Collection().PathL();
       
   170     CleanupStack::PushL( navigationalState );
       
   171     if (navigationalState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid))
       
   172         {
       
   173         // As image viewer is direct fullscreen view, 
       
   174         // it will not have title. 
       
   175         SetTitleL(KBlankTitle);
       
   176         }
       
   177     else if(iFixedTitle)
   168         {
   178         {
   169         // If there is a fixed title, set it
   179         // If there is a fixed title, set it
   170         SetTitleL(*iFixedTitle);
   180         SetTitleL(*iFixedTitle);
   171         }
   181         }
   172     else
   182     else
   177 
   187 
   178         CMPXCollectionPath* path = iMediaList->PathLC( NGlxListDefs::EPathParent );
   188         CMPXCollectionPath* path = iMediaList->PathLC( NGlxListDefs::EPathParent );
   179         iTitleFetcher = CGlxTitleFetcher::NewL(*this, path);
   189         iTitleFetcher = CGlxTitleFetcher::NewL(*this, path);
   180         CleanupStack::PopAndDestroy(path);
   190         CleanupStack::PopAndDestroy(path);
   181         }
   191         }
       
   192     CleanupStack::PopAndDestroy( navigationalState );
   182    
   193    
   183     //Allow the MskController to observe medialist everytime a view with a valid
   194     //Allow the MskController to observe medialist everytime a view with a valid
   184     //medialist becomes active
   195     //medialist becomes active
   185     if( iCbaControl && Cba()&& iEnableMidddleSoftkey )
   196     if( iCbaControl && Cba()&& iEnableMidddleSoftkey )
   186         {
   197         {
   196             iCbaControl->SetMainStatusL();
   207             iCbaControl->SetMainStatusL();
   197             }
   208             }
   198         CleanupStack::PopAndDestroy(navigationalState);
   209         CleanupStack::PopAndDestroy(navigationalState);
   199         }
   210         }
   200     
   211     
       
   212     DoMLViewActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
   201     //Allow the toolbarController to observe medialist everytime a view with a valid
   213     //Allow the toolbarController to observe medialist everytime a view with a valid
   202     //medialist becomes active
   214     //medialist becomes active
   203     if( Toolbar() && iToolbarControl )
   215     if( GetToolBar() && iToolbarControl )
   204         {
   216        {
   205         iToolbarControl->AddToObserverL(*iMediaList, Toolbar());
   217        iToolbarControl->AddToObserverL(*iMediaList, GetToolBar());
   206         iToolbarControl->SetStatusOnViewActivationL(iMediaList);
   218        iToolbarControl->SetStatusOnViewActivationL(iMediaList);
   207         }    
   219        }   
   208   
       
   209     DoMLViewActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
       
   210     }
   220     }
   211 
   221 
   212 // -----------------------------------------------------------------------------
   222 // -----------------------------------------------------------------------------
   213 // DoViewDeactivate
   223 // DoViewDeactivate
   214 // -----------------------------------------------------------------------------
   224 // -----------------------------------------------------------------------------
   215 //	
   225 //	
   216 EXPORT_C void CGlxMediaListViewBase::DoViewDeactivate()
   226 EXPORT_C void CGlxMediaListViewBase::DoViewDeactivate()
   217     {
   227     {
       
   228     TRACER ("CGlxMediaListViewBase::DoViewDeactivate()");
       
   229     //Need to be done before the view deactivation
       
   230     //as the grid toolbar will be deleted in grid deactivation.
       
   231     
       
   232     if (GetToolBar() && iToolbarControl && iMediaList)
       
   233          {
       
   234          //Remove Toolbarcontroller from medialist observer
       
   235          iToolbarControl->RemoveFromObserver(*iMediaList);
       
   236          }
   218     DoMLViewDeactivate();
   237     DoMLViewDeactivate();
   219 
   238 
   220     if( iMediaList )
   239     if( iMediaList )
   221         {
   240         {
   222         if (iCbaControl && Cba())
   241         if (iCbaControl && Cba())
   223             {
   242             {
   224             //Remove Mskcontroller from medialist observer
   243             //Remove Mskcontroller from medialist observer
   225             iCbaControl->RemoveFromObserver(*iMediaList);
   244             iCbaControl->RemoveFromObserver(*iMediaList);
   226             }
   245             }
   227         if (Toolbar() && iToolbarControl)
       
   228             {
       
   229             //Remove Toolbarcontroller from medialist observer
       
   230             iToolbarControl->RemoveFromObserver(*iMediaList);
       
   231             }
       
   232 
       
   233         // Only close the medialist if navigating backwards
   246         // Only close the medialist if navigating backwards
   234         if (iUiUtility->ViewNavigationDirection() == EGlxNavigationBackwards)
   247         if (iUiUtility->ViewNavigationDirection() == EGlxNavigationBackwards)
   235             {
   248             {
   236             CloseMediaList();
   249             CloseMediaList();
   237             }
   250             }