photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp
branchRCL_3
changeset 14 ce1c7ad1f18b
parent 13 71da52165949
child 18 bcb43dc84c44
equal deleted inserted replaced
13:71da52165949 14:ce1c7ad1f18b
    40 
    40 
    41 #include <gesturehelper.h>
    41 #include <gesturehelper.h>
    42 
    42 
    43 using namespace GestureHelper;
    43 using namespace GestureHelper;
    44 
    44 
    45 //Hg 
       
    46 //#include <hg/hgcontextutility.h>
       
    47 #include <glxhdmicontroller.h>
    45 #include <glxhdmicontroller.h>
    48 
    46 
    49 // Photos Headers
    47 // Photos Headers
    50 #include <glxlog.h>                             // CGlxLogger
    48 #include <glxlog.h>                             // CGlxLogger
    51 #include <glxtracer.h>                          // For Log
    49 #include <glxtracer.h>                          // For Log
    52 #include <glxmedialistmulmodelprovider.h>       // For MulModelProvider
    50 #include <glxmedialistmulmodelprovider.h>       // For MulModelProvider
    53 #include <glxcommandhandlers.hrh>               // For EGlxCmdFullScreenBack               
    51 #include <glxcommandhandlers.hrh>               // For EGlxCmdFullScreenBack               
    54 #include <glxfullscreenviewdata.rsg>            // FS View Resource
    52 #include <glxfullscreenviewdata.rsg>            // FS View Resource
    55 #include <glxthumbnailattributeinfo.h>          // KGlxMediaIdThumbnail
    53 #include <glxthumbnailattributeinfo.h>          // KGlxMediaIdThumbnail
    56 //#include "glxmediakeyutility.h"
       
    57 #include <glxactivemedialistregistry.h>         // For medialist registry
    54 #include <glxactivemedialistregistry.h>         // For medialist registry
    58 #include <glxerrormanager.h>
    55 #include <glxerrormanager.h>
    59 #include <glxzoomcontrol.h>
    56 #include <glxzoomcontrol.h>
    60 #include <glxuiutilities.rsg>
    57 #include <glxuiutilities.rsg>
    61 #include <glxgeneraluiutilities.h>
    58 #include <glxgeneraluiutilities.h>
    62 #include <glxtexturemanager.h>
    59 #include <glxtexturemanager.h>
    63 #include <glxicons.mbg>
    60 #include <glxicons.mbg>
    64 #include <glxsetappstate.h>
    61 #include <glxsetappstate.h>
    65 #include <glxdrmutility.h>
    62 #include <glxdrmutility.h>
    66 #include <glxscreenfurniture.h>
    63 #include <glxscreenfurniture.h>
    67 //#include <glxsinglelinemetapanecontrol.h>
       
    68 #include "glxfullscreenviewimp.h"
    64 #include "glxfullscreenviewimp.h"
    69 #include <glxnavigationalstate.h>
    65 #include <glxnavigationalstate.h>
    70 #include <glxmedia.h>
    66 #include <glxmedia.h>
    71 #include <glxnavigationalstate.h>
    67 #include <glxnavigationalstate.h>
    72 #include <mpxcollectionpath.h>
    68 #include <mpxcollectionpath.h>
    73 #include <glxcollectionpluginimageviewer.hrh>
    69 #include <glxcollectionpluginimageviewer.hrh>
    74 
    70 #include "glxfullscreenbusyicon.h"
    75 using namespace Alf;
    71 using namespace Alf;
    76 
    72 
    77 const TInt KGlxScreenTimeout =10000000;
    73 const TInt KGlxScreenTimeout =10000000;
    78 const TInt KCoverflowDataWindowSize = 1;
    74 const TInt KCoverflowDataWindowSize = 1;
    79 const TInt KGlxMaxSmallImageZoomLevel =150;
    75 const TInt KGlxMaxSmallImageZoomLevel =150;
   196 
   192 
   197 	//create the drmutility instance
   193 	//create the drmutility instance
   198 	iDrmUtility = CGlxDRMUtility::InstanceL();
   194 	iDrmUtility = CGlxDRMUtility::InstanceL();
   199    // Get object that stores the active media list registry
   195    // Get object that stores the active media list registry
   200     iActiveMediaListRegistry = CGlxActiveMediaListRegistry::InstanceL();
   196     iActiveMediaListRegistry = CGlxActiveMediaListRegistry::InstanceL();
   201     if(!iPeriodic)
   197 	
       
   198 	TInt err = iHarvesterClient.Connect();
       
   199 	GLX_LOG_INFO1("iHarvesterClient.Connect() err = %d",err);
       
   200 	if(err == KErrNone)
       
   201 		{
       
   202         iHarvesterClient.AddHarvesterEventObserver(*this, EHEObserverTypeMMC, 1000);
       
   203 	    }
       
   204 	if(!iPeriodic)
   202 		{
   205 		{
   203 		iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard);
   206 		iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard);
   204 		}
   207 		}
   205     }
   208     }
   206 
   209 
   209 // ---------------------------------------------------------------------------
   212 // ---------------------------------------------------------------------------
   210 //
   213 //
   211 CGlxFullScreenViewImp::~CGlxFullScreenViewImp()
   214 CGlxFullScreenViewImp::~CGlxFullScreenViewImp()
   212     {
   215     {
   213     TRACER("CGlxFullScreenViewImp::~CGlxFullScreenViewImp");
   216     TRACER("CGlxFullScreenViewImp::~CGlxFullScreenViewImp");
   214     delete iMediaListMulModelProvider;   
   217     iHarvesterClient.Close();
       
   218 	delete iMediaListMulModelProvider;   
   215     if(iTimer->IsActive())
   219     if(iTimer->IsActive())
   216 	    {
   220 	    {
   217 	    iTimer->Cancel();
   221 	    iTimer->Cancel();
   218 	    }
   222 	    }
   219 	delete iTimer;   
   223 	delete iTimer;   
   320 		   	{
   324 		   	{
   321 		   	navigationalState->SetToViewMode();
   325 		   	navigationalState->SetToViewMode();
   322 		   	}
   326 		   	}
   323 		}
   327 		}
   324 		
   328 		
   325 	
       
   326     if(naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid))
   329     if(naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid))
   327         {
   330         {
   328         iImgViewerMode = ETrue;
   331         iImgViewerMode = ETrue;
   329         }
   332         }
   330     //destroy and close navistate and navipath
   333     //destroy and close navistate and navipath
   331     CleanupStack::PopAndDestroy( naviState );
   334     CleanupStack::PopAndDestroy( naviState );
   332     CleanupStack::PopAndDestroy( navigationalState );
   335     CleanupStack::PopAndDestroy( navigationalState );
   333 
   336 
   334     //Create hdmicontroller when it is only launched from fullscreen.  
   337     //Create hdmicontroller when it is only launched from fullscreen.  
   335     //From filemanager show only clone mode.
   338     //From filemanager show only clone mode.
   336     if(!iImgViewerMode && iMediaList->Count())    
   339     if( !iImgViewerMode )    
   337         {
   340         {
   338         iHdmiController = CGlxHdmiController::NewL();    
   341         iHdmiController = CGlxHdmiController::NewL();    
   339         iOldFocusIndex = iMediaList->FocusIndex();
   342         SetItemToHDMIL();
   340         SetImageL();
       
   341         }
   343         }
   342     iScreenFurniture->SetActiveView(iViewUid);
   344     iScreenFurniture->SetActiveView(iViewUid);
   343 
   345 
   344     // create the screen furniture for touch devices
   346     // create the screen furniture for touch devices
   345     CreateScreenFurnitureL();
   347     CreateScreenFurnitureL();
   350    	GlxSetAppState::SetState(EGlxInFullScreenView);
   352    	GlxSetAppState::SetState(EGlxInFullScreenView);
   351    	 
   353    	 
   352     // create the coverflow
   354     // create the coverflow
   353     CreateCoverflowWidgetL();
   355     CreateCoverflowWidgetL();
   354     
   356     
   355     
       
   356     CreateSliderWidgetL();
   357     CreateSliderWidgetL();
   357     
   358     
   358 //    iMediaKeyUtility = CGlxMediaKeyUtility::NewL();
   359     iBusyIcon = CGlxFullScreenBusyIcon::NewL(*iMediaList,*iUiUtility);
   359     
       
   360     // create a zoom control
   360     // create a zoom control
   361     iZoomControl = CGlxZoomControl::NewL(*this, *iMediaList,
   361     iZoomControl = CGlxZoomControl::NewL(*this, *iMediaList,
   362             *iZoomButtonGroup, *iSliderWidget, iGestureHelper);
   362             *iZoomButtonGroup, *iSliderWidget, iGestureHelper);
   363 
       
   364     // Create the Metapane
       
   365     //iSingleLineMetaPane = CGlxSingleLineMetaPane::NewL(*this,*iMediaList,*iUiUtility);
       
   366 
   363 
   367     // hide the screen furniture
   364     // hide the screen furniture
   368     HideUi(ETrue);
   365     HideUi(ETrue);
   369 	// Set active media list pointer, so that UPnP renderer knows about this list
   366 	// Set active media list pointer, so that UPnP renderer knows about this list
   370     iActiveMediaListRegistry->RegisterActiveMediaList(iMediaList);
   367     iActiveMediaListRegistry->RegisterActiveMediaList(iMediaList);
   371     
   368     
   372     //Get the HgContextUtility instance
   369     if ( !iPeriodic->IsActive() )
   373 //    iContextUtility = iUiUtility->ContextUtility();
   370 	    {
   374 
   371 	    iPeriodic->Start(KPeriodicStartDelay, KPeriodicIntervalDelay,
   375     // if the Medialist has any item, set the First index context to Hg Context Utility
   372 	            TCallBack(&PeriodicCallback, static_cast<TAny*> (this)));
   376 //    TGlxMedia item = iMediaList->Item( iMediaList->FocusIndex() );
   373 	    }
   377 //    iContextUtility->PublishPhotoContextL(item.Uri());
       
   378     	if ( !iPeriodic->IsActive() )
       
   379 		{
       
   380         iPeriodic->Start(KPeriodicStartDelay, KPeriodicIntervalDelay,
       
   381                 TCallBack(&PeriodicCallback, static_cast<TAny*> (this)));
       
   382 		}
       
   383 	}
   374 	}
   384 	
   375 	
   385 
   376 
   386 // ---------------------------------------------------------------------------
   377 // ---------------------------------------------------------------------------
   387 // Creates a coverflow widget
   378 // Creates a coverflow widget
   466         //adding the range and slider tick value 
   457         //adding the range and slider tick value 
   467         if(iSliderModel)
   458         if(iSliderModel)
   468             {
   459             {
   469             iSliderModel->SetTick(KGlxSliderTickValue);
   460             iSliderModel->SetTick(KGlxSliderTickValue);
   470             }
   461             }
   471         
       
   472         //SetSliderLevel();
       
   473         
       
   474         }
   462         }
   475     catch(...)
   463     catch(...)
   476         {
   464         {
   477         User::Leave(KErrGeneral);
   465         User::Leave(KErrGeneral);
   478         }
   466         }
   491     TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), KGlxMediaIdThumbnail);
   479     TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), KGlxMediaIdThumbnail);
   492        
   480        
   493     TBool isDrmRightsValid = ETrue;
   481     TBool isDrmRightsValid = ETrue;
   494 	if(item.IsDrmProtected())
   482 	if(item.IsDrmProtected())
   495 		{
   483 		{
   496 		isDrmRightsValid = iDrmUtility->CheckOpenRightsL(item.Uri(),
   484 		//Fix for ESLM-82WJ59: Since it is always for the focused item - use DisplayRightsL instead of openrightsL
   497 												(item.Category() == EMPXImage));
   485 		isDrmRightsValid = iDrmUtility->CheckDisplayRightsL(item.Uri(), (item.Category() == EMPXImage));
   498 		}
   486 		}
   499 	
   487 	
   500     // Display slider only for non corrupted images and items with valid DRM license
   488     // Display slider only for non corrupted images and items with valid DRM license
   501     if (error == KErrNone && item.Category() == EMPXImage && isDrmRightsValid)
   489     if (error == KErrNone && item.Category() == EMPXImage && isDrmRightsValid)
   502         {
   490         {
   522     // For floating toolbar in non-touch devices
   510     // For floating toolbar in non-touch devices
   523     iScreenFurniture->SetToolbarVisibility(ETrue);
   511     iScreenFurniture->SetToolbarVisibility(ETrue);
   524     //show the softkeys
   512     //show the softkeys
   525     Cba()->MakeVisible( ETrue );
   513     Cba()->MakeVisible( ETrue );
   526     Cba()->DrawNow();
   514     Cba()->DrawNow();
   527 
       
   528     // Show the Metapane
       
   529     //iSingleLineMetaPane->ShowMetaPane(ETrue);
       
   530 
   515 
   531     //set the ui state to On
   516     //set the ui state to On
   532     SetUiSate(NGlxNFullScreenUIState::EUiOn);
   517     SetUiSate(NGlxNFullScreenUIState::EUiOn);
   533     
   518     
   534     //start the timer,for the screen timeout
   519     //start the timer,for the screen timeout
   697    
   682    
   698     // Check if DRM rights expired for a specific media item 
   683     // Check if DRM rights expired for a specific media item 
   699     TBool isDrmRightsValid = ETrue;
   684     TBool isDrmRightsValid = ETrue;
   700     if(item.IsDrmProtected())
   685     if(item.IsDrmProtected())
   701     	{
   686     	{
   702     	isDrmRightsValid = iDrmUtility->CheckOpenRightsL(item.Uri(),
   687     	 //Fix for ESLM-82WJ59: DRM Rights validity check for displayed item
   703 												(item.Category() == EMPXImage));
   688     	isDrmRightsValid = iDrmUtility->CheckDisplayRightsL(item.Uri(), (item.Category() == EMPXImage));
   704     	}
   689     	}
   705     // Activate Zoom if the item is an image and its DRM rights is not expired
   690     // Activate Zoom if the item is an image and its DRM rights is not expired
   706     if(KErrNone == error && (EMPXImage == item.Category()) && isDrmRightsValid)
   691     if(KErrNone == error && (EMPXImage == item.Category()) && isDrmRightsValid)
   707         {
   692         {
   708         if(iZoomControl && !iZoomControl->Activated())
   693         if(iZoomControl && !iZoomControl->Activated())
   709             {
   694             {
   710             if(iHdmiController)
   695             if(iHdmiController)
   711                 {
   696                 {
   712                 iHdmiController->ActivateZoom();
   697                 TBool autoZoomOut = ETrue;
       
   698                 //Set autozoomout to false in pinch zoom, since we would be 
       
   699                 //zooming out on deactivate once we get the release event.
       
   700                 if(aStartMode == EZoomStartPinch)                    
       
   701                     {
       
   702                     autoZoomOut = EFalse; 
       
   703                     }
       
   704                 
       
   705                 iHdmiController->ActivateZoom(autoZoomOut);
   713                 }
   706                 }
   714             iZoomControl->ActivateL(GetInitialZoomLevel(),aStartMode, focus,
   707             iZoomControl->ActivateL(GetInitialZoomLevel(),aStartMode, focus,
   715                                         item, apZoomFocus,iImgViewerMode);
   708                                         item, apZoomFocus,iImgViewerMode);
   716             // Now to remove all textures other than the one we are focussing on.  
   709             // Now to remove all textures other than the one we are focussing on.  
   717             TInt count = iMediaList->Count();
   710             TInt count = iMediaList->Count();
   739 // ---------------------------------------------------------------------------
   732 // ---------------------------------------------------------------------------
   740 //
   733 //
   741 void CGlxFullScreenViewImp::DeactivateZoomControlL()
   734 void CGlxFullScreenViewImp::DeactivateZoomControlL()
   742     {
   735     {
   743     TRACER("CGlxFullScreenViewImp::DeactivateZoomControlL");
   736     TRACER("CGlxFullScreenViewImp::DeactivateZoomControlL");
   744     ActivateFullScreenL(); 
   737     ActivateFullScreenL();
       
   738     //Deactivate HDMI controller for zoom out while pinch zooming.
       
   739     if(iHdmiController)
       
   740         {
       
   741         iHdmiController->DeactivateZoom();
       
   742         }
   745     if(iZoomControl->Activated())
   743     if(iZoomControl->Activated())
   746         {
   744         {        
   747         iZoomControl->Deactivate();
   745         iZoomControl->Deactivate();
   748         }
   746         }
   749     //Once into fullscreen view,show the screen furniture
   747     //Once into fullscreen view,show the screen furniture
   750     HideUi(ETrue);
   748     HideUi(ETrue);
   751     }
   749     }
   756 // ---------------------------------------------------------------------------
   754 // ---------------------------------------------------------------------------
   757 //
   755 //
   758 void CGlxFullScreenViewImp::DoMLViewDeactivate()
   756 void CGlxFullScreenViewImp::DoMLViewDeactivate()
   759     {
   757     {
   760     TRACER("CGlxFullScreenViewImp::DoMLViewDeactivate");
   758     TRACER("CGlxFullScreenViewImp::DoMLViewDeactivate");
   761     // if Medialist Count is Zero, set the navigation state to 
   759     //Fix for ESLM-82WJ59: Clear the last uri for which DRM Rights were consumed before going back to grid view
   762     // EGlxNavigationBackwards before going back to grid view
   760     //since the GridView::Activate() and FullScreen::DeActivate() can be called in any order,
   763     if(iMediaList->Count() == 0)
   761     //this call is being made to be on safer side
   764     	{
   762     iDrmUtility->ClearLastConsumedItemUri();
   765     	iUiUtility->SetViewNavigationDirection(EGlxNavigationBackwards);
       
   766     	} 
       
   767     iScreenFurniture->ViewDeactivated(iViewUid);
   763     iScreenFurniture->ViewDeactivated(iViewUid);
   768     iImgViewerMode = EFalse;
   764     iImgViewerMode = EFalse;
   769     if (iHdmiController)
   765     if (iHdmiController)
   770         {
   766         {
   771         delete iHdmiController;
   767         delete iHdmiController;
   991                 {
   987                 {
   992                 GLX_LOG_INFO("CGlxFullScreenViewImp::OfferEventL ETypeDoubleTap");   
   988                 GLX_LOG_INFO("CGlxFullScreenViewImp::OfferEventL ETypeDoubleTap");   
   993 
   989 
   994                 MulDoubleTapData* DoubleTapData = (MulDoubleTapData*)(aEvent.CustomEventData()); 
   990                 MulDoubleTapData* DoubleTapData = (MulDoubleTapData*)(aEvent.CustomEventData()); 
   995                 TPoint doubleTapPoint = DoubleTapData->mDoubleTapPoint;
   991                 TPoint doubleTapPoint = DoubleTapData->mDoubleTapPoint;
   996                 SetSliderLevel();
   992                 TInt focus = iMediaList->FocusIndex();
   997                 TRAP_IGNORE( ActivateZoomControlL(EZoomStartDoubleTap, &doubleTapPoint) );
   993                 TGlxMedia item = iMediaList->Item( focus );
       
   994                 TSize size;
       
   995                 item.GetDimensions( size );
       
   996                 TRect rect = AlfUtil::ScreenSize();
       
   997                 TInt zoomLevel = GetInitialZoomLevel();
       
   998                 TInt tlX = (rect.Width() - (size.iWidth*zoomLevel)/100)/2;
       
   999                 TInt tlY = (rect.Height() - (size.iHeight*zoomLevel)/100)/2;
       
  1000                 TRect imageRect(TPoint(tlX, tlY), TSize((size.iWidth*zoomLevel)/100, (size.iHeight*zoomLevel)/100));
       
  1001                 if (imageRect.Contains(doubleTapPoint))
       
  1002                     {
       
  1003                     SetSliderLevel();
       
  1004                     TRAP_IGNORE( ActivateZoomControlL(EZoomStartDoubleTap, &doubleTapPoint)  );
       
  1005                     }
   998                 return EEventConsumed;
  1006                 return EEventConsumed;
   999                 }
  1007                 }
  1000             case ETypeItemRemoved:
  1008             case ETypeItemRemoved:
  1001                 {
  1009                 {
  1002                 if(iHdmiController)
  1010                 SetItemToHDMIL();
  1003                     {
       
  1004                      SetImageL();
       
  1005                     }
       
  1006                 iOldFocusIndex = iMediaList->FocusIndex();
       
  1007                 return EEventConsumed;
  1011                 return EEventConsumed;
  1008                 }
  1012                 }
  1009             case ETypeHighlight:
  1013             case ETypeHighlight:
  1010                 {
  1014                 {
  1011                 iMediaList->SetFocusL( NGlxListDefs::EAbsolute,(aEvent.CustomEventData())); 
  1015                 iMediaList->SetFocusL( NGlxListDefs::EAbsolute,(aEvent.CustomEventData())); 
  1015                 	}
  1019                 	}
  1016                 if(iMediaList->Count()> KFullScreenTextureOffset)
  1020                 if(iMediaList->Count()> KFullScreenTextureOffset)
  1017                     {
  1021                     {
  1018                     RemoveTexture();
  1022                     RemoveTexture();
  1019                     }
  1023                     }
  1020                 if(iHdmiController)
  1024                 SetItemToHDMIL();
  1021                     {
       
  1022                      SetImageL();
       
  1023                     }
       
  1024                 iOldFocusIndex = iMediaList->FocusIndex();
       
  1025                 if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() )
  1025                 if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() )
  1026                     {
  1026                     {
  1027                     HideUi(ETrue);
  1027                     HideUi(ETrue);
  1028                     }
  1028                     }
  1029                 TRAP_IGNORE(ShowDrmExpiaryNoteL());
  1029                 TRAP_IGNORE(ShowDrmExpiaryNoteL());
  1060                     }
  1060                     }
  1061                 return EEventConsumed; // will be consumed even if we are pinching IN (trying to zoom OUT). 
  1061                 return EEventConsumed; // will be consumed even if we are pinching IN (trying to zoom OUT). 
  1062                 //slider event handling   
  1062                 //slider event handling   
  1063             case ETypePrimaryValueChange:
  1063             case ETypePrimaryValueChange:
  1064                 {
  1064                 {
  1065                 // Zoomview is only launched if the currentslider value is above the level
       
  1066                 // of fullscreenlevel.
       
  1067                 iTimer->Cancel();
  1065                 iTimer->Cancel();
  1068                 iSliderWidget->ShowWidget( ETrue, 0 );
  1066                 iSliderWidget->ShowWidget( ETrue, 0 );
  1069                 TRAP_IGNORE( ActivateZoomControlL(EZoomStartSlider));
  1067                 TRAPD( err, ActivateZoomControlL(EZoomStartSlider));
       
  1068                 if (err != KErrNone)
       
  1069                     {
       
  1070                     iSliderModel->SetPrimaryValue(GetInitialZoomLevel());
       
  1071                     }
  1070                 }
  1072                 }
  1071                 return EEventConsumed;
  1073                 return EEventConsumed;
  1072             default:
  1074             default:
  1073                 return EEventNotHandled;
  1075                 return EEventNotHandled;
  1074             }
  1076             }
  1098 		    DeactivateZoomControlL();
  1100 		    DeactivateZoomControlL();
  1099 		    consumed = ETrue;
  1101 		    consumed = ETrue;
  1100 		    break;
  1102 		    break;
  1101 		case EGlxCmdRenameCompleted:
  1103 		case EGlxCmdRenameCompleted:
  1102 		    {
  1104 		    {
  1103             if (iHdmiController)
  1105             SetItemToHDMIL();
  1104                 {
       
  1105                 SetImageL();
       
  1106                 }
       
  1107 			consumed = ETrue;
  1106 			consumed = ETrue;
  1108             break;
  1107             break;
  1109             }
  1108             }
  1110 //		case EGlxCmdRotateLeft:
       
  1111 //			iCoverFlowWidget->RotateImage(IMulWidget::ERotateLeft,size,KGlxRotationDelay);
       
  1112 //		    consumed = ETrue;
       
  1113 //		    break;
       
  1114 //		case EGlxCmdRotateRight:
       
  1115 //		    iCoverFlowWidget->RotateImage(IMulWidget::ERotateRight,size,KGlxRotationDelay);
       
  1116 //            consumed = ETrue;
       
  1117 //            break;
       
  1118         } 
  1109         } 
  1119     return consumed;
  1110     return consumed;
  1120     }
  1111     }
  1121 
  1112 
  1122 // ---------------------------------------------------------------------------
  1113 // ---------------------------------------------------------------------------
  1350         {
  1341         {
  1351         // check if rights have expired
  1342         // check if rights have expired
  1352         TBool expired = !iDrmUtility->CheckOpenRightsL(uri,ETrue);
  1343         TBool expired = !iDrmUtility->CheckOpenRightsL(uri,ETrue);
  1353         if(expired)
  1344         if(expired)
  1354             {
  1345             {
       
  1346 			iBusyIcon->ShowBusyIconL(EFalse);				
  1355             iDrmUtility->ShowRightsInfoL(uri);
  1347             iDrmUtility->ShowRightsInfoL(uri);
  1356             return;
  1348             return;
  1357             }
  1349             }
  1358         iDrmUtility->ConsumeRightsL(uri);                        
  1350         iDrmUtility->ConsumeRightsL(uri);                        
  1359         }     
  1351         }     
  1382         }
  1374         }
  1383     else
  1375     else
  1384         {
  1376         {
  1385         swipedirection = (focusindex-iOldFocusIndex < 0 ? EBackward : EForward) ;
  1377         swipedirection = (focusindex-iOldFocusIndex < 0 ? EBackward : EForward) ;
  1386         }     
  1378         }     
  1387       return swipedirection;        
  1379     GLX_LOG_INFO1("CGlxFullScreenViewImp::GetSwipeDirection()"
       
  1380             " Direction = [%d] ", swipedirection);
       
  1381 
       
  1382     return swipedirection;        
  1388     }
  1383     }
  1389 // ---------------------------------------------------------------------------
  1384 // ---------------------------------------------------------------------------
  1390 // 
  1385 // 
  1391 // Gets the index of the item for which the texture has to be removed
  1386 // Gets the index of the item for which the texture has to be removed
  1392 // ---------------------------------------------------------------------------
  1387 // ---------------------------------------------------------------------------
  1428     TRACER("CGlxFullScreenViewImp::RemoveTexture");
  1423     TRACER("CGlxFullScreenViewImp::RemoveTexture");
  1429     
  1424     
  1430     const TGlxMedia& item = iMediaList->Item(GetIndexToBeRemoved());
  1425     const TGlxMedia& item = iMediaList->Item(GetIndexToBeRemoved());
  1431     iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse);
  1426     iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse);
  1432     }
  1427     }
       
  1428 
  1433 // ---------------------------------------------------------------------------
  1429 // ---------------------------------------------------------------------------
  1434 // 
  1430 // 
  1435 // Set the image to external display - HDMI
  1431 // Set the image to external display - HDMI
  1436 // ---------------------------------------------------------------------------
  1432 // ---------------------------------------------------------------------------
  1437 //
  1433 //
  1438 void CGlxFullScreenViewImp::SetImageL()
  1434 void CGlxFullScreenViewImp::SetItemToHDMIL()
  1439     {
  1435     {
  1440     TRACER("CGlxFullScreenViewImp::SetImageL - CGlxHdmi");
  1436     TRACER("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi");
  1441     TGlxMedia item = iMediaList->Item(iMediaList->FocusIndex());
  1437 
       
  1438     TInt focusIndex = iMediaList->FocusIndex();
       
  1439 
       
  1440     // If we dont know what item we are focussing on 
       
  1441     // or if out medialist is empty
       
  1442     // or if HDMI is not connected 
       
  1443     // or if there is no HDMI Controller at all 
       
  1444     // then dont SetImageToHDMI :)  
       
  1445     if( ( KErrNotFound == focusIndex)
       
  1446             || (0 == iMediaList->Count())
       
  1447             || (NULL == iHdmiController)
       
  1448             || (!iHdmiController->IsHDMIConnected())) 
       
  1449         {
       
  1450         GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - Cant Set Image To HDMI");
       
  1451         return;
       
  1452         }
       
  1453     
       
  1454     TGlxMedia item = iMediaList->Item(focusIndex);
  1442     TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(),
  1455     TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(),
  1443             KGlxMediaIdThumbnail);
  1456         KGlxMediaIdThumbnail);
  1444     if (item.Category() != EMPXVideo && iDrmUtility->CheckOpenRightsL(
  1457     
  1445             item.Uri(), ETrue) && (error == KErrNone))
  1458     // Item will be supported by HDMI ONLY if
  1446         {
  1459     // it is not a video
       
  1460     // and it has valid DRM Viewing rights
       
  1461     // and it has no attribute error 
       
  1462     if ( (item.Category() != EMPXVideo) 
       
  1463             && iDrmUtility->CheckOpenRightsL(item.Uri(), ETrue) 
       
  1464             && (error == KErrNone) )
       
  1465         {
       
  1466         GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - Setting the Image");
  1447         TInt frameCount(0);
  1467         TInt frameCount(0);
  1448         TSize orignalSize;
  1468         TSize orignalSize;
  1449         TBool aFramesPresent = item.GetFrameCount(frameCount);
  1469         item.GetFrameCount(frameCount);
  1450         TBool adimension = item.GetDimensions(orignalSize);
  1470         item.GetDimensions(orignalSize);
  1451         iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount);
  1471         iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount);
  1452         GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageL - CGlxHdmi - calling SetImage");
       
  1453         }
  1472         }
  1454     else
  1473     else
  1455         {
  1474         {
  1456         GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageL - CGlxHdmi - calling IsVideo");
  1475         GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - Unsupported Item");
  1457         //Set the external display to cloning mode.
  1476         //Set the external display to cloning mode if
  1458         //If the current item is a video, corruted thumbnail
  1477         //the current item is something we dont support 
  1459         iHdmiController->IsVideo();
  1478         //(e.g. video, corrupted item, item with invalid DRM);
  1460         }
  1479         iHdmiController->ItemNotSupported();
  1461     }
  1480         }
       
  1481     iOldFocusIndex = iMediaList->FocusIndex();
       
  1482     }
       
  1483 // ---------------------------------------------------------------------------
       
  1484 // HarvestingUpdated
       
  1485 // 
       
  1486 // ---------------------------------------------------------------------------
       
  1487 //
       
  1488 void CGlxFullScreenViewImp::HarvestingUpdated( 
       
  1489                 HarvesterEventObserverType HarvestingUpdated, 
       
  1490                 HarvesterEventState aHarvesterEventState,
       
  1491                 TInt aItemsLeft )
       
  1492     {
       
  1493     TRACER("CGlxFullScreenViewImp::HarvestingUpdated()");
       
  1494     if(HarvestingUpdated == EHEObserverTypeMMC)
       
  1495         {
       
  1496         if(iZoomControl && iZoomControl->Activated())
       
  1497         	{
       
  1498         	SetSliderLevel();
       
  1499 		    DeactivateZoomControlL();	
       
  1500         	}
       
  1501         ProcessCommandL(EAknSoftkeyClose);
       
  1502         }
       
  1503     }