photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp
branchRCL_3
changeset 13 bcb43dc84c44
parent 12 ce1c7ad1f18b
child 14 2dac0fdba72b
equal deleted inserted replaced
12:ce1c7ad1f18b 13:bcb43dc84c44
    22 #include <eikbtgpc.h>                           // CEikButtonGroupContainer
    22 #include <eikbtgpc.h>                           // CEikButtonGroupContainer
    23 #include <aknViewAppUi.h>
    23 #include <aknViewAppUi.h>
    24 #include <data_caging_path_literals.hrh>        // for KDC_APP_RESOURCE_DIR
    24 #include <data_caging_path_literals.hrh>        // for KDC_APP_RESOURCE_DIR
    25 #include <glxcollectionpluginimageviewer.hrh>
    25 #include <glxcollectionpluginimageviewer.hrh>
    26 #include <StringLoader.h>                       // String Loader
    26 #include <StringLoader.h>                       // String Loader
       
    27 
       
    28 //For animation Effects
       
    29 #include <akntranseffect.h>
       
    30 #include <akntransitionutils.h>
       
    31 #include <alf/alflayout.h>
    27 
    32 
    28 // Alf Headers
    33 // Alf Headers
    29 #include <alf/ialfwidgetfactory.h>              // widget factory
    34 #include <alf/ialfwidgetfactory.h>              // widget factory
    30 #include <alf/alfwidgetcontrol.h>               // To get CAlfControl from CAlfWidgetControl
    35 #include <alf/alfwidgetcontrol.h>               // To get CAlfControl from CAlfWidgetControl
    31 #include <alf/ialfviewwidget.h>                 // View Widget
    36 #include <alf/ialfviewwidget.h>                 // View Widget
    66 #include <glxmedia.h>
    71 #include <glxmedia.h>
    67 #include <glxnavigationalstate.h>
    72 #include <glxnavigationalstate.h>
    68 #include <mpxcollectionpath.h>
    73 #include <mpxcollectionpath.h>
    69 #include <glxcollectionpluginimageviewer.hrh>
    74 #include <glxcollectionpluginimageviewer.hrh>
    70 #include "glxfullscreenbusyicon.h"
    75 #include "glxfullscreenbusyicon.h"
       
    76 
    71 using namespace Alf;
    77 using namespace Alf;
    72 
    78 
    73 const TInt KGlxScreenTimeout =10000000;
    79 const TInt KGlxScreenTimeout =10000000;
    74 const TInt KCoverflowDataWindowSize = 1;
    80 const TInt KCoverflowDataWindowSize = 1;
    75 const TInt KGlxMaxSmallImageZoomLevel =150;
    81 const TInt KGlxMaxSmallImageZoomLevel =150;
    85  * Interval delay for the periodic timer, in microseconds
    91  * Interval delay for the periodic timer, in microseconds
    86  */
    92  */
    87 const TInt KPeriodicIntervalDelay = 100000; 
    93 const TInt KPeriodicIntervalDelay = 100000; 
    88 
    94 
    89 //This constant is used to calculate the index of the item for which texture has to removed.
    95 //This constant is used to calculate the index of the item for which texture has to removed.
    90 //6 = 5(iterator value in forward or backward direction for fullscreen) + 1(focus index);
    96 //6 = 5(iterator value in forward or backward direction for fullscreen) + 1(focus index)
    91 const TInt KFullScreenIterator = 3; 
    97 const TInt KFullScreenIterator = 3; 
    92 //Constant which says maximum number of fullscreen textures that we have have at a time.
    98 //Constant which says maximum number of fullscreen textures that we have have at a time.
    93 //11 = (5(5 fullscreen texture backwards)+1(fucus index texture)+5(5 fullscreen texture forwards))
    99 //11 = (5(5 fullscreen texture backwards)+1(fucus index texture)+5(5 fullscreen texture forwards))
    94 const TInt KFullScreenTextureOffset = 5;
   100 const TInt KFullScreenTextureOffset = 5;
       
   101 
       
   102 _LIT( KTfxResourceActivateFullScreen, "z:\\resource\\effects\\photos_fullscreen_open.fxml" );
    95 
   103 
    96 // ======== MEMBER FUNCTIONS ========
   104 // ======== MEMBER FUNCTIONS ========
    97 
   105 
    98 // ---------------------------------------------------------------------------
   106 // ---------------------------------------------------------------------------
    99 // C++ default constructor can NOT contain any code, that
   107 // C++ default constructor can NOT contain any code, that
   193 	//create the drmutility instance
   201 	//create the drmutility instance
   194 	iDrmUtility = CGlxDRMUtility::InstanceL();
   202 	iDrmUtility = CGlxDRMUtility::InstanceL();
   195    // Get object that stores the active media list registry
   203    // Get object that stores the active media list registry
   196     iActiveMediaListRegistry = CGlxActiveMediaListRegistry::InstanceL();
   204     iActiveMediaListRegistry = CGlxActiveMediaListRegistry::InstanceL();
   197 	
   205 	
   198 	TInt err = iHarvesterClient.Connect();
   206 	iMMCNotifier = CGlxMMCNotifier::NewL(*this);
   199 	GLX_LOG_INFO1("iHarvesterClient.Connect() err = %d",err);
       
   200 	if(err == KErrNone)
       
   201 		{
       
   202         iHarvesterClient.AddHarvesterEventObserver(*this, EHEObserverTypeMMC, 1000);
       
   203 	    }
       
   204 	if(!iPeriodic)
   207 	if(!iPeriodic)
   205 		{
   208 		{
   206 		iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard);
   209 		iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard);
   207 		}
   210 		}
   208     }
   211     }
   212 // ---------------------------------------------------------------------------
   215 // ---------------------------------------------------------------------------
   213 //
   216 //
   214 CGlxFullScreenViewImp::~CGlxFullScreenViewImp()
   217 CGlxFullScreenViewImp::~CGlxFullScreenViewImp()
   215     {
   218     {
   216     TRACER("CGlxFullScreenViewImp::~CGlxFullScreenViewImp");
   219     TRACER("CGlxFullScreenViewImp::~CGlxFullScreenViewImp");
   217     iHarvesterClient.Close();
   220     
       
   221     delete iMMCNotifier;
       
   222     iMMCNotifier = NULL;
       
   223     
   218 	delete iMediaListMulModelProvider;   
   224 	delete iMediaListMulModelProvider;   
   219     if(iTimer->IsActive())
   225     if(iTimer->IsActive())
   220 	    {
   226 	    {
   221 	    iTimer->Cancel();
   227 	    iTimer->Cancel();
   222 	    }
   228 	    }
   340         {
   346         {
   341         iHdmiController = CGlxHdmiController::NewL();    
   347         iHdmiController = CGlxHdmiController::NewL();    
   342         SetItemToHDMIL();
   348         SetItemToHDMIL();
   343         }
   349         }
   344     iScreenFurniture->SetActiveView(iViewUid);
   350     iScreenFurniture->SetActiveView(iViewUid);
   345 
       
   346     // create the screen furniture for touch devices
       
   347     CreateScreenFurnitureL();
       
   348     
   351     
   349     //set the ui state to off,when the Fullscreen launches
   352     //set the ui state to off,when the Fullscreen launches
   350     SetUiSate(NGlxNFullScreenUIState::EUiOff);
   353     SetUiSate(NGlxNFullScreenUIState::EUiOff);
   351    
   354    
   352    	GlxSetAppState::SetState(EGlxInFullScreenView);
   355    	GlxSetAppState::SetState(EGlxInFullScreenView);
   353    	 
   356    	 
   354     // create the coverflow
   357     // create the coverflow
   355     CreateCoverflowWidgetL();
   358     CreateCoverflowWidgetL();
   356     
   359     
       
   360     // create the screen furniture for touch devices
       
   361     CreateScreenFurnitureL();
       
   362     
   357     CreateSliderWidgetL();
   363     CreateSliderWidgetL();
   358     
   364     
   359     iBusyIcon = CGlxFullScreenBusyIcon::NewL(*iMediaList,*iUiUtility);
   365     iBusyIcon = CGlxFullScreenBusyIcon::NewL(*iMediaList,*iUiUtility);
   360     // create a zoom control
   366     // create a zoom control
   361     iZoomControl = CGlxZoomControl::NewL(*this, *iMediaList,
   367     iZoomControl = CGlxZoomControl::NewL(*this, *iMediaList,
   364     // hide the screen furniture
   370     // hide the screen furniture
   365     HideUi(ETrue);
   371     HideUi(ETrue);
   366 	// Set active media list pointer, so that UPnP renderer knows about this list
   372 	// Set active media list pointer, so that UPnP renderer knows about this list
   367     iActiveMediaListRegistry->RegisterActiveMediaList(iMediaList);
   373     iActiveMediaListRegistry->RegisterActiveMediaList(iMediaList);
   368     
   374     
   369     if ( !iPeriodic->IsActive() )
   375 	if ( !iPeriodic->IsActive() )
   370 	    {
   376 		{
   371 	    iPeriodic->Start(KPeriodicStartDelay, KPeriodicIntervalDelay,
   377 	    iPeriodic->Start(KPeriodicStartDelay, KPeriodicIntervalDelay,
   372 	            TCallBack(&PeriodicCallback, static_cast<TAny*> (this)));
   378 	            TCallBack(&PeriodicCallback, static_cast<TAny*> (this)));
   373 	    }
   379 		}
       
   380 		
       
   381 	//Set the animation effect for the coverflow widget since the animation
       
   382 	//does not work for both avkon and alf together. This can be done since the
       
   383 	//UI Screen furnitures are disabled by default while going to fullscreen.
       
   384 	//Check if the transitions are enabled from themes
       
   385     if (CAknTransitionUtils::TransitionsEnabled(
       
   386                                     AknTransEffect::EFullScreenTransitionsOff))
       
   387         {
       
   388         const_cast<CAlfLayout&> (iCoverFlowWidget->ContainerLayout()).SetEffectL(
       
   389                 KTfxResourceActivateFullScreen);
       
   390         }
       
   391     
       
   392 	//Disable the status pane here as it causes flicker while animating
       
   393     CAknViewAppUi* appui = AppUi();
       
   394     if ( appui )
       
   395         {
       
   396         appui->StatusPane()->MakeVisible(EFalse);
       
   397         appui->Cba()->MakeVisible(EFalse);
       
   398         }
       
   399 
       
   400 	iViewWidget->show(true);    
   374 	}
   401 	}
   375 	
   402 	
   376 
   403 
   377 // ---------------------------------------------------------------------------
   404 // ---------------------------------------------------------------------------
   378 // Creates a coverflow widget
   405 // Creates a coverflow widget
   398                 0x113);
   425                 0x113);
   399         // hide control and status pane
   426         // hide control and status pane
   400         iViewWidget->enableControlPane(EFalse);
   427         iViewWidget->enableControlPane(EFalse);
   401         iViewWidget->enableStatusPane(EFalse);
   428         iViewWidget->enableStatusPane(EFalse);
   402         iViewWidget->setRect(TRect(TPoint(0, 0), AlfUtil::ScreenSize()));
   429         iViewWidget->setRect(TRect(TPoint(0, 0), AlfUtil::ScreenSize()));
   403         iViewWidget->show(true);
       
   404         // create coverflow widget
   430         // create coverflow widget
   405         iCoverFlowWidget = widgetFactory.createWidget<IMulCoverFlowWidget> (
   431         iCoverFlowWidget = widgetFactory.createWidget<IMulCoverFlowWidget> (
   406                 KWidgetName, KCoverflowWidget, *iViewWidget, NULL);
   432                 KWidgetName, KCoverflowWidget, *iViewWidget, NULL);
   407         iCoverFlowWidget->SetFlags(IMulMultiItemWidget::EMulWidgetDoubleTap);
   433         iCoverFlowWidget->SetFlags(IMulMultiItemWidget::EMulWidgetDoubleTap);
   408 
   434 
   409         // Widget takes the ownership
   435         // Widget takes the ownership
   410         iCoverFlowWidget->AddEventHandler(*this);
   436         iCoverFlowWidget->AddEventHandler(*this);
   411 
   437 
   412         CAknViewAppUi* appui = AppUi();
       
   413         if ( appui )
       
   414             {
       
   415             appui->StatusPane()->MakeVisible(EFalse);
       
   416             appui->Cba()->MakeVisible(EFalse);
       
   417             }
       
   418 
       
   419         iCoverFlowWidget->ShowWidget(ETrue);
       
   420         iCoverFlowWidget->control()->AcquireFocus();
   438         iCoverFlowWidget->control()->AcquireFocus();
   421         iMediaListMulModelProvider = CGlxMediaListMulModelProvider::NewL(
   439         iMediaListMulModelProvider = CGlxMediaListMulModelProvider::NewL(
   422                 *iEnv, *iCoverFlowWidget, *iMediaList, iFullScreenBindingSet,
   440                 *iEnv, *iCoverFlowWidget, *iMediaList, iFullScreenBindingSet,
   423                 mulwidget::KTemplate4, KCoverflowDataWindowSize);
   441                 mulwidget::KTemplate4, KCoverflowDataWindowSize);
   424 
   442 
   479     TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), KGlxMediaIdThumbnail);
   497     TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), KGlxMediaIdThumbnail);
   480        
   498        
   481     TBool isDrmRightsValid = ETrue;
   499     TBool isDrmRightsValid = ETrue;
   482 	if(item.IsDrmProtected())
   500 	if(item.IsDrmProtected())
   483 		{
   501 		{
   484 		//Fix for ESLM-82WJ59: Since it is always for the focused item - use DisplayRightsL instead of openrightsL
   502 		//Since it is always for the focused item - use DisplayItemRightsCheckL instead of ItemRightsValidityCheckL
   485 		isDrmRightsValid = iDrmUtility->CheckDisplayRightsL(item.Uri(), (item.Category() == EMPXImage));
   503 		isDrmRightsValid = iDrmUtility->DisplayItemRightsCheckL(item.Uri(),
       
   504 				(item.Category() == EMPXImage));
   486 		}
   505 		}
   487 	
   506 	
   488     // Display slider only for non corrupted images and items with valid DRM license
   507     // Display slider only for non corrupted images and items with valid DRM license
   489     if (error == KErrNone && item.Category() == EMPXImage && isDrmRightsValid)
   508     if (error == KErrNone && item.Category() == EMPXImage && isDrmRightsValid)
   490         {
   509         {
   554         }    
   573         }    
   555     
   574     
   556     // hide the softkeys
   575     // hide the softkeys
   557     Cba()->MakeVisible( EFalse );
   576     Cba()->MakeVisible( EFalse );
   558     Cba()->DrawNow();
   577     Cba()->DrawNow();
   559     // Hide the metapane
       
   560     //iSingleLineMetaPane->ShowMetaPane(EFalse);
       
   561  
   578  
   562     // set the ui state to On
   579     // set the ui state to On
   563     SetUiSate(NGlxNFullScreenUIState::EUiOff);
   580     SetUiSate(NGlxNFullScreenUIState::EUiOff);
   564     }
   581     }
   565 
   582 
   572     TRACER("CGlxFullScreenViewImp::CreateScreenFurnitureL");
   589     TRACER("CGlxFullScreenViewImp::CreateScreenFurnitureL");
   573     // create the softkeys
   590     // create the softkeys
   574     CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
   591     CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
   575     CleanupStack::PushL( cba );
   592     CleanupStack::PushL( cba );
   576     cba->SetCommandSetL(R_GLX_FULLSCREEN_SOFTKEYS);
   593     cba->SetCommandSetL(R_GLX_FULLSCREEN_SOFTKEYS);
   577     // hide the softkeys
       
   578     cba->MakeVisible( EFalse );
       
   579     cba->DrawNow();
       
   580     CleanupStack::Pop(cba);
   594     CleanupStack::Pop(cba);
   581     }
   595     }
   582 
   596 
   583 // ---------------------------------------------------------------------------
   597 // ---------------------------------------------------------------------------
   584 // SetUiSate
   598 // SetUiSate
   682    
   696    
   683     // Check if DRM rights expired for a specific media item 
   697     // Check if DRM rights expired for a specific media item 
   684     TBool isDrmRightsValid = ETrue;
   698     TBool isDrmRightsValid = ETrue;
   685     if(item.IsDrmProtected())
   699     if(item.IsDrmProtected())
   686     	{
   700     	{
   687     	 //Fix for ESLM-82WJ59: DRM Rights validity check for displayed item
   701     	 //DRM Rights validity check for displayed item
   688     	isDrmRightsValid = iDrmUtility->CheckDisplayRightsL(item.Uri(), (item.Category() == EMPXImage));
   702     	isDrmRightsValid = iDrmUtility->DisplayItemRightsCheckL(item.Uri(),
       
   703 				(item.Category() == EMPXImage));
   689     	}
   704     	}
   690     // Activate Zoom if the item is an image and its DRM rights is not expired
   705     // Activate Zoom if the item is an image and its DRM rights is not expired
   691     if(KErrNone == error && (EMPXImage == item.Category()) && isDrmRightsValid)
   706     if(KErrNone == error && (EMPXImage == item.Category()) && isDrmRightsValid)
   692         {
   707         {
   693         if(iZoomControl && !iZoomControl->Activated())
   708         if(iZoomControl && !iZoomControl->Activated())
   754 // ---------------------------------------------------------------------------
   769 // ---------------------------------------------------------------------------
   755 //
   770 //
   756 void CGlxFullScreenViewImp::DoMLViewDeactivate()
   771 void CGlxFullScreenViewImp::DoMLViewDeactivate()
   757     {
   772     {
   758     TRACER("CGlxFullScreenViewImp::DoMLViewDeactivate");
   773     TRACER("CGlxFullScreenViewImp::DoMLViewDeactivate");
   759     //Fix for ESLM-82WJ59: Clear the last uri for which DRM Rights were consumed before going back to grid view
   774     //Clear the last uri for which DRM Rights were consumed before going back to grid view
   760     //since the GridView::Activate() and FullScreen::DeActivate() can be called in any order,
   775     //since the GridView::Activate() and FullScreen::DeActivate() can be called in any order,
   761     //this call is being made to be on safer side
   776     //this call is being made to be on safer side
   762     iDrmUtility->ClearLastConsumedItemUri();
   777     iDrmUtility->ClearLastConsumedItemUriL();
   763     iScreenFurniture->ViewDeactivated(iViewUid);
   778     iScreenFurniture->ViewDeactivated(iViewUid);
   764     iImgViewerMode = EFalse;
   779     iImgViewerMode = EFalse;
   765     if (iHdmiController)
   780     if (iHdmiController)
   766         {
   781         {
   767         delete iHdmiController;
   782         delete iHdmiController;
   798 //
   813 //
   799 void CGlxFullScreenViewImp::HandleForegroundEventL(TBool aForeground)
   814 void CGlxFullScreenViewImp::HandleForegroundEventL(TBool aForeground)
   800     {
   815     {
   801     TRACER("CGlxFullScreenViewImp::HandleForegroundEventL");
   816     TRACER("CGlxFullScreenViewImp::HandleForegroundEventL");
   802     CAknView::HandleForegroundEventL(aForeground);
   817     CAknView::HandleForegroundEventL(aForeground);
   803     
   818     if(iMMCState)
   804 	
   819         {
       
   820         iMMCState =EFalse;
       
   821         NavigateToMainListL();
       
   822         }
       
   823     
   805     if(iZoomControl && iZoomControl->Activated())
   824     if(iZoomControl && iZoomControl->Activated())
   806         {
   825         {
   807         iZoomControl->HandleZoomForegroundEvent(aForeground);
   826         iZoomControl->HandleZoomForegroundEvent(aForeground);
   808         }
   827         }
   809 
   828 
  1265     TRACER("CGlxFullScreenViewImp::CallPeriodicCallback");
  1284     TRACER("CGlxFullScreenViewImp::CallPeriodicCallback");
  1266     TRAP_IGNORE(ShowDrmExpiaryNoteL());
  1285     TRAP_IGNORE(ShowDrmExpiaryNoteL());
  1267     }
  1286     }
  1268 	
  1287 	
  1269 // ---------------------------------------------------------------------------
  1288 // ---------------------------------------------------------------------------
  1270 // 
  1289 // Shows expiry note / Consumes DRM rights for expired DRM files
  1271 // Shows expiry note/dialog for expired DRM files, can leave
       
  1272 // ---------------------------------------------------------------------------
  1290 // ---------------------------------------------------------------------------
  1273 //
  1291 //
  1274 void CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()
  1292 void CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()
  1275 	{
  1293 	{
  1276 	TRACER("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL");
  1294     TRACER("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL");
  1277 	if(iMediaList->Count()>0)
  1295     if (iMediaList->Count() > 0)
  1278 		{
  1296         {
  1279         const TGlxMedia& media = iMediaList->Item(iMediaList->FocusIndex());
  1297         const TGlxMedia& media = iMediaList->Item(iMediaList->FocusIndex());
  1280         TInt tnError = GlxErrorManager::HasAttributeErrorL(
  1298         TInt tnError = GlxErrorManager::HasAttributeErrorL(
  1281                 media.Properties(), KGlxMediaIdThumbnail);
  1299                 media.Properties(), KGlxMediaIdThumbnail);
  1282         GLX_LOG_INFO1("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()"
  1300         GLX_LOG_INFO1("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()"
  1283                 " tnError=%d ", tnError);
  1301                 " tnError=%d ", tnError);
  1284 
  1302 
  1285         TSize tnSize = iUiUtility->DisplaySize();
  1303         if (media.IsDrmProtected())
  1286         TMPXAttribute qtyTnAttrib = TMPXAttribute(KGlxMediaIdThumbnail,
  1304             {
  1287                 GlxFullThumbnailAttributeId(ETrue, tnSize.iWidth,
  1305             GLX_LOG_INFO("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()"
  1288                         tnSize.iHeight));
  1306                     "- ConsumeDRMRightsL()");
  1289         const CGlxThumbnailAttribute* qtyTn = media.ThumbnailAttribute(
  1307             ConsumeDRMRightsL(media);
  1290                 qtyTnAttrib);
  1308             }
  1291 
  1309 
  1292         if (qtyTn)
  1310         if (tnError == KErrNone)
  1293             {
  1311             {
  1294             if (iPeriodic->IsActive())
  1312             if (iPeriodic->IsActive())
  1295                 {
  1313                 {
  1296                 iPeriodic->Cancel();
  1314                 iPeriodic->Cancel();
  1297                 }
  1315                 }
  1298             }
  1316             }
  1299 
  1317 
  1300         if (tnError == KErrNone && qtyTn && media.IsDrmProtected())
  1318         TMPXGeneralCategory cat = media.Category();
  1301             {
  1319         TBool checkViewRights = (cat == EMPXImage);
  1302             GLX_LOG_INFO("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()"
  1320         if (iDrmUtility->ItemRightsValidityCheckL(media.Uri(),
  1303                     "- ConsumeDRMRightsL()");
  1321                 checkViewRights) && tnError != KErrNone)
  1304             const TDesC& uri = media.Uri();
       
  1305             ConsumeDRMRightsL(uri);
       
  1306             }
       
  1307 
       
  1308         if (tnError != KErrNone)
       
  1309             {
  1322             {
  1310             if (iPeriodic->IsActive())
  1323             if (iPeriodic->IsActive())
  1311                 {
  1324                 {
  1312                 iPeriodic->Cancel();
  1325                 iPeriodic->Cancel();
  1313                 }
  1326                 }
  1324                 GlxGeneralUiUtilities::ShowErrorNoteL(tnError);
  1337                 GlxGeneralUiUtilities::ShowErrorNoteL(tnError);
  1325                 }
  1338                 }
  1326             CleanupStack::PopAndDestroy(naviState);
  1339             CleanupStack::PopAndDestroy(naviState);
  1327             CleanupStack::PopAndDestroy(navigationalState);
  1340             CleanupStack::PopAndDestroy(navigationalState);
  1328             }
  1341             }
  1329          }
  1342         }
  1330 	}
  1343     }
  1331 
  1344 
  1332 // ---------------------------------------------------------------------------
  1345 // ---------------------------------------------------------------------------
  1333 // 
  1346 // Consumes DRM rights / Shows DRM rights (if expired) information 
  1334 // consumes DRM rights for DRM files, can leave
  1347 // for DRM files
  1335 // ---------------------------------------------------------------------------
  1348 // ---------------------------------------------------------------------------
  1336 //
  1349 //
  1337 void CGlxFullScreenViewImp::ConsumeDRMRightsL( const TDesC& uri )
  1350 void CGlxFullScreenViewImp::ConsumeDRMRightsL(const TGlxMedia& aMedia)
  1338     {
  1351     {
  1339     TRACER("CGlxFullScreenViewImp::ConsumeDRMRightsL");
  1352     TRACER("CGlxFullScreenViewImp::ConsumeDRMRightsL");
  1340     if( uri.Length() > 0 )
  1353     const TDesC& uri = aMedia.Uri();
       
  1354     if (uri.Length() > 0)
  1341         {
  1355         {
  1342         // check if rights have expired
  1356         // check if rights have expired
  1343         TBool expired = !iDrmUtility->CheckOpenRightsL(uri,ETrue);
  1357         TBool expired = !iDrmUtility->ItemRightsValidityCheckL(uri, ETrue);
  1344         if(expired)
  1358         if (expired)
  1345             {
  1359             {
  1346 			iBusyIcon->ShowBusyIconL(EFalse);				
  1360             if (iPeriodic->IsActive())
       
  1361                 {
       
  1362                 iPeriodic->Cancel();
       
  1363                 }
       
  1364             iBusyIcon->ShowBusyIconL(EFalse);
  1347             iDrmUtility->ShowRightsInfoL(uri);
  1365             iDrmUtility->ShowRightsInfoL(uri);
  1348             return;
  1366             return;
  1349             }
  1367             }
  1350         iDrmUtility->ConsumeRightsL(uri);                        
  1368 
  1351         }     
  1369         TSize tnSize = iUiUtility->DisplaySize();
       
  1370         TMPXAttribute qtyTnAttrib = TMPXAttribute(KGlxMediaIdThumbnail,
       
  1371                 GlxFullThumbnailAttributeId(ETrue, tnSize.iWidth,
       
  1372                         tnSize.iHeight));
       
  1373         const CGlxThumbnailAttribute* qtyTn = aMedia.ThumbnailAttribute(
       
  1374                 qtyTnAttrib);
       
  1375 
       
  1376         TInt tnError = GlxErrorManager::HasAttributeErrorL(
       
  1377                 aMedia.Properties(), KGlxMediaIdThumbnail);
       
  1378         GLX_LOG_INFO1("CGlxFullScreenViewImp::ConsumeDRMRightsL()"
       
  1379                 " tnError=%d ", tnError);
       
  1380         if (qtyTn && tnError == KErrNone)
       
  1381             {
       
  1382             if (iPeriodic->IsActive())
       
  1383                 {
       
  1384                 iPeriodic->Cancel();
       
  1385                 }
       
  1386             GLX_LOG_INFO("CGlxFullScreenViewImp::ConsumeDRMRightsL()"
       
  1387                     "- ConsumeRights");
       
  1388             iDrmUtility->ConsumeRightsL(uri);
       
  1389             }
       
  1390         }
  1352     }
  1391     }
  1353 
  1392 
  1354 // ---------------------------------------------------------------------------
  1393 // ---------------------------------------------------------------------------
  1355 // 
  1394 // 
  1356 // Gets the Swipe direction
  1395 // Gets the Swipe direction
  1379     GLX_LOG_INFO1("CGlxFullScreenViewImp::GetSwipeDirection()"
  1418     GLX_LOG_INFO1("CGlxFullScreenViewImp::GetSwipeDirection()"
  1380             " Direction = [%d] ", swipedirection);
  1419             " Direction = [%d] ", swipedirection);
  1381 
  1420 
  1382     return swipedirection;        
  1421     return swipedirection;        
  1383     }
  1422     }
       
  1423 
  1384 // ---------------------------------------------------------------------------
  1424 // ---------------------------------------------------------------------------
  1385 // 
  1425 // 
  1386 // Gets the index of the item for which the texture has to be removed
  1426 // Gets the index of the item for which the texture has to be removed
  1387 // ---------------------------------------------------------------------------
  1427 // ---------------------------------------------------------------------------
  1388 //
  1428 //
  1411           }        
  1451           }        
  1412         }
  1452         }
  1413     GLX_LOG_INFO1("CGlxFullScreenViewImp::GetIndexToBeRemoved index tobe removed %d",indextoberemoved );
  1453     GLX_LOG_INFO1("CGlxFullScreenViewImp::GetIndexToBeRemoved index tobe removed %d",indextoberemoved );
  1414     return indextoberemoved;
  1454     return indextoberemoved;
  1415     }
  1455     }
       
  1456 
  1416 // ---------------------------------------------------------------------------
  1457 // ---------------------------------------------------------------------------
  1417 // 
  1458 // 
  1418 // Remove the texture on every swipe while HDMI is connected.
  1459 // Remove the texture on every swipe while HDMI is connected.
  1419 // ---------------------------------------------------------------------------
  1460 // ---------------------------------------------------------------------------
  1420 //
  1461 //
  1442     // or if HDMI is not connected 
  1483     // or if HDMI is not connected 
  1443     // or if there is no HDMI Controller at all 
  1484     // or if there is no HDMI Controller at all 
  1444     // then dont SetImageToHDMI :)  
  1485     // then dont SetImageToHDMI :)  
  1445     if( ( KErrNotFound == focusIndex)
  1486     if( ( KErrNotFound == focusIndex)
  1446             || (0 == iMediaList->Count())
  1487             || (0 == iMediaList->Count())
  1447             || (NULL == iHdmiController)
  1488             || (NULL == iHdmiController)) 
  1448             || (!iHdmiController->IsHDMIConnected())) 
       
  1449         {
  1489         {
  1450         GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - Cant Set Image To HDMI");
  1490         GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - Cant Set Image To HDMI");
  1451         return;
  1491         return;
  1452         }
  1492         }
  1453     
  1493     
  1458     // Item will be supported by HDMI ONLY if
  1498     // Item will be supported by HDMI ONLY if
  1459     // it is not a video
  1499     // it is not a video
  1460     // and it has valid DRM Viewing rights
  1500     // and it has valid DRM Viewing rights
  1461     // and it has no attribute error 
  1501     // and it has no attribute error 
  1462     if ( (item.Category() != EMPXVideo) 
  1502     if ( (item.Category() != EMPXVideo) 
  1463             && iDrmUtility->CheckOpenRightsL(item.Uri(), ETrue) 
  1503             && iDrmUtility->ItemRightsValidityCheckL(item.Uri(), ETrue) 
  1464             && (error == KErrNone) )
  1504             && (error == KErrNone) )
  1465         {
  1505         {
  1466         GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - Setting the Image");
  1506         GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - Setting the Image");
  1467         TInt frameCount(0);
  1507         iHdmiController->SetImageL(item.Uri());
  1468         TSize orignalSize;
       
  1469         item.GetFrameCount(frameCount);
       
  1470         item.GetDimensions(orignalSize);
       
  1471         iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount);
       
  1472         }
  1508         }
  1473     else
  1509     else
  1474         {
  1510         {
  1475         GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - Unsupported Item");
  1511         GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - Unsupported Item");
  1476         //Set the external display to cloning mode if
  1512         //Set the external display to cloning mode if
  1477         //the current item is something we dont support 
  1513         //the current item is something we dont support 
  1478         //(e.g. video, corrupted item, item with invalid DRM);
  1514         //(e.g. video, corrupted item, item with invalid DRM)
  1479         iHdmiController->ItemNotSupported();
  1515         iHdmiController->ItemNotSupported();
  1480         }
  1516         }
  1481     iOldFocusIndex = iMediaList->FocusIndex();
  1517     iOldFocusIndex = iMediaList->FocusIndex();
  1482     }
  1518     }
  1483 // ---------------------------------------------------------------------------
  1519 
  1484 // HarvestingUpdated
  1520 // ---------------------------------------------------------------------------
       
  1521 // HandleMMCInsertionL
  1485 // 
  1522 // 
  1486 // ---------------------------------------------------------------------------
  1523 // ---------------------------------------------------------------------------
  1487 //
  1524 void CGlxFullScreenViewImp::HandleMMCInsertionL()
  1488 void CGlxFullScreenViewImp::HarvestingUpdated( 
  1525     {
  1489                 HarvesterEventObserverType HarvestingUpdated, 
  1526     TRACER("CGlxFullScreenViewImp::HandleMMCInsertionL()");
  1490                 HarvesterEventState aHarvesterEventState,
  1527     iMMCState = ETrue;
  1491                 TInt aItemsLeft )
  1528     NavigateToMainListL();
  1492     {
  1529     }
  1493     TRACER("CGlxFullScreenViewImp::HarvestingUpdated()");
  1530 	
  1494     if(HarvestingUpdated == EHEObserverTypeMMC)
  1531 // ---------------------------------------------------------------------------
       
  1532 // NavigateToMainListL
       
  1533 // 
       
  1534 // ---------------------------------------------------------------------------
       
  1535 void CGlxFullScreenViewImp::NavigateToMainListL()
       
  1536     {
       
  1537     TRACER("CGlxFullScreenViewImp::NavigateToMainListL()");
       
  1538     CGlxNavigationalState* navigationalState =  CGlxNavigationalState::InstanceL();
       
  1539     CleanupClosePushL( *navigationalState );
       
  1540     CMPXCollectionPath* naviState = navigationalState->StateLC();
       
  1541     if (naviState->Id() != TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid))
  1495         {
  1542         {
  1496         if(iZoomControl && iZoomControl->Activated())
  1543         if(iZoomControl && iZoomControl->Activated())
  1497         	{
  1544         	{
  1498         	SetSliderLevel();
  1545         	SetSliderLevel();
  1499 		    DeactivateZoomControlL();	
  1546 		    DeactivateZoomControlL();	
  1500         	}
  1547         	}
  1501         ProcessCommandL(EAknSoftkeyClose);
  1548         ProcessCommandL(EAknSoftkeyClose);
  1502         }
  1549         }
  1503     }
  1550     CleanupStack::PopAndDestroy(naviState);
       
  1551     CleanupStack::PopAndDestroy(navigationalState);
       
  1552     }
       
  1553 	
       
  1554 // ---------------------------------------------------------------------------
       
  1555 // HandleMMCInsertionL
       
  1556 // 
       
  1557 // ---------------------------------------------------------------------------
       
  1558 void CGlxFullScreenViewImp::HandleMMCRemovalL()
       
  1559     {
       
  1560     TRACER("CGlxFullScreenViewImp::HandleMMCRemovalL()");
       
  1561     if(iZoomControl && iZoomControl->Activated())
       
  1562         {
       
  1563         SetSliderLevel();
       
  1564         DeactivateZoomControlL();   
       
  1565         }
       
  1566     ProcessCommandL(EAknSoftkeyExit);
       
  1567     }