photosgallery/viewframework/views/gridview/src/glxgridviewcontainer.cpp
branchRCL_3
changeset 13 bcb43dc84c44
parent 12 ce1c7ad1f18b
child 14 2dac0fdba72b
equal deleted inserted replaced
12:ce1c7ad1f18b 13:bcb43dc84c44
    83 // ---------------------------------------------------------------------------
    83 // ---------------------------------------------------------------------------
    84 //
    84 //
    85 CGlxGridViewContainer::~CGlxGridViewContainer()
    85 CGlxGridViewContainer::~CGlxGridViewContainer()
    86 	{
    86 	{
    87 	TRACER("CGlxGridViewContainer::~CGlxGridViewContainer");
    87 	TRACER("CGlxGridViewContainer::~CGlxGridViewContainer");
    88 	iHarvesterClient.Close();
    88 	
       
    89 	delete iMMCNotifier;
       
    90 	iMMCNotifier = NULL;
       
    91 	
    89 	if(iBgContext)
    92 	if(iBgContext)
    90 		{
    93 		{
    91 		delete iBgContext;	
    94 		delete iBgContext;	
    92 		}
    95 		}
    93 	if(iDRMUtility)
    96 	if(iDRMUtility)
   159 	iItemsPerPage = iUiUtility->VisibleItemsInPageGranularityL();
   162 	iItemsPerPage = iUiUtility->VisibleItemsInPageGranularityL();
   160 
   163 
   161 	// For DRM Utility
   164 	// For DRM Utility
   162 	iDRMUtility = CGlxDRMUtility::InstanceL();
   165 	iDRMUtility = CGlxDRMUtility::InstanceL();
   163 
   166 
   164 	//Fix for ESLM-82WJ59: Clear the last uri for which DRM Rights were consumed
   167     //Clear the last uri for which DRM Rights were consumed
   165 	//since the GridView::Activate() and FullScreen::DeActivate() can be called in any order,
   168     //since the GridView::Activate() and FullScreen::DeActivate() 
   166 	//this call is being made to be on safer side
   169     //can be called in any order, this call is being made to be on safer side
   167 	iDRMUtility->ClearLastConsumedItemUri();
   170     iDRMUtility->ClearLastConsumedItemUriL();
   168 
   171 
   169 	// background Skin Context for the skin support
   172 	// background Skin Context for the skin support
   170 	TRect apRect = iEikonEnv->EikAppUi()->ApplicationRect();
   173 	TRect apRect = iEikonEnv->EikAppUi()->ApplicationRect();
   171 	iBgContext = CAknsBasicBackgroundControlContext::NewL(
   174 	iBgContext = CAknsBasicBackgroundControlContext::NewL(
   172 			KAknsIIDQsnBgScreen,apRect,ETrue);
   175 			KAknsIIDQsnBgScreen,apRect,ETrue);
   178 	iSpeedTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail,
   181 	iSpeedTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail,
   179 			GlxFullThumbnailAttributeId( EFalse,  iGridIconSize.iWidth,
   182 			GlxFullThumbnailAttributeId( EFalse,  iGridIconSize.iWidth,
   180 					iGridIconSize.iHeight ) );
   183 					iGridIconSize.iHeight ) );
   181 	CreateGridL();
   184 	CreateGridL();
   182 
   185 
   183    TInt err = iHarvesterClient.Connect();
   186    iMMCNotifier = CGlxMMCNotifier::NewL(*this);
   184    GLX_LOG_INFO1("iHarvesterClient.Connect() err = %d",err);
       
   185    if(err == KErrNone)
       
   186 		{
       
   187         iHarvesterClient.AddHarvesterEventObserver(*this, EHEObserverTypeMMC, 1000);
       
   188 		}
       
   189 	}
   187 	}
   190 
   188 
   191 // ---------------------------------------------------------------------------
   189 // ---------------------------------------------------------------------------
   192 // From OfferKeyEventL
   190 // From OfferKeyEventL
   193 // Default implementation,
   191 // Default implementation,
   493 // ---------------------------------------------------------------------------
   491 // ---------------------------------------------------------------------------
   494 //
   492 //
   495 void CGlxGridViewContainer::CreateGridAfterFSDeactivatedL()
   493 void CGlxGridViewContainer::CreateGridAfterFSDeactivatedL()
   496 	{
   494 	{
   497 	TRACER("CGlxGridViewContainer::CreateGridAfterFSDeactivatedL()");
   495 	TRACER("CGlxGridViewContainer::CreateGridAfterFSDeactivatedL()");
   498 	if (iBackwardActivation)
   496     TInt focusIndex = iMediaList->FocusIndex();
       
   497     GLX_LOG_INFO1("CreateGridAfterFSDeactivatedL() focusIndex=%d", focusIndex);
       
   498 
       
   499     if (iBackwardActivation)
   499 		{
   500 		{
   500 		TInt mlCount = iMediaList->Count();
   501 		TInt mlCount = iMediaList->Count();
   501 		GLX_LOG_INFO1("CreateGridAfterFSDeactivatedL() mlCount=%d", mlCount);
   502 		GLX_LOG_INFO1("CreateGridAfterFSDeactivatedL() mlCount=%d", mlCount);
   502 
   503 
   503 		// Setting the Empty Text
   504 		// Setting the Empty Text
   510 			{
   511 			{
   511 			GLX_LOG_INFO("CreateGridAfterFSDeactivatedL() - SetEmptyTextL()");
   512 			GLX_LOG_INFO("CreateGridAfterFSDeactivatedL() - SetEmptyTextL()");
   512 			iHgGrid->DrawNow();
   513 			iHgGrid->DrawNow();
   513 			}
   514 			}
   514 
   515 
   515 		TInt focusIndex = iMediaList->FocusIndex();
       
   516 		TSize setSize = CHgGrid::PreferredImageSize();
   516 		TSize setSize = CHgGrid::PreferredImageSize();
   517 		TFileName resFile(KDC_APP_BITMAP_DIR);
   517 		TFileName resFile(KDC_APP_BITMAP_DIR);
   518 		resFile.Append(KGlxIconsFilename);
   518 		resFile.Append(KGlxIconsFilename);
   519 
   519 
   520 		for (TInt index=0; index<mlCount; index++)
   520 		for (TInt index=0; index<mlCount; index++)
   521 			{
   521 			{
   522 			SetIconsL(index);
   522 			SetIconsL(index);
   523 			}
   523 			}
   524 			
   524 		}
   525 		iHgGrid->SetSelectedIndex(focusIndex);
   525 	
   526 		iHgGrid->RefreshScreen(focusIndex);
   526     if (focusIndex != KErrNotFound)
   527 		}
   527         {
       
   528         iHgGrid->SetSelectedIndex(focusIndex);
       
   529         iHgGrid->RefreshScreen(focusIndex);
       
   530         }
   528 	iBackwardActivation = EFalse;
   531 	iBackwardActivation = EFalse;
   529 	}
   532 	}
   530  
   533  
   531 // ---------------------------------------------------------------------------
   534 // ---------------------------------------------------------------------------
   532 // SetIconsL
   535 // SetIconsL
   605 				 * to show the invalid DRM icon
   608 				 * to show the invalid DRM icon
   606 				 */
   609 				 */
   607 				TMPXGeneralCategory  cat = item.Category();
   610 				TMPXGeneralCategory  cat = item.Category();
   608 				TBool checkViewRights = (cat==EMPXImage);
   611 				TBool checkViewRights = (cat==EMPXImage);
   609 
   612 
   610 				if(iDRMUtility->CheckOpenRightsL(uri, checkViewRights))
   613 				if(iDRMUtility->ItemRightsValidityCheckL(uri, checkViewRights))
   611 					{
   614 					{
   612 					iHgGrid->ItemL(index).SetFlags(CHgItem::EHgItemFlagsDrmRightsValid);
   615 					iHgGrid->ItemL(index).SetFlags(CHgItem::EHgItemFlagsDrmRightsValid);
   613 					}
   616 					}
   614 				else
   617 				else
   615 					{
   618 					{
   619 			else
   622 			else
   620 				{
   623 				{
   621 				TMPXGeneralCategory  cat = item.Category();
   624 				TMPXGeneralCategory  cat = item.Category();
   622 				TBool checkViewRights = (cat==EMPXImage);
   625 				TBool checkViewRights = (cat==EMPXImage);
   623 
   626 
   624 				if(iDRMUtility->CheckOpenRightsL(uri, checkViewRights))
   627 				if(iDRMUtility->ItemRightsValidityCheckL(uri, checkViewRights))
   625 					{
   628 					{
   626 					iHgGrid->ItemL(index).SetFlags(CHgItem::EHgItemFlagsDrmRightsValid);
   629 					iHgGrid->ItemL(index).SetFlags(CHgItem::EHgItemFlagsDrmRightsValid);
   627 					}
   630 					}
   628 				else
   631 				else
   629 					{
   632 					{
   729 					//we need to guard the event by a flag.
   732 					//we need to guard the event by a flag.
   730 					if(!iIsFSVideoViewActivating)
   733 					if(!iIsFSVideoViewActivating)
   731 						{
   734 						{
   732 						iIsFSVideoViewActivating = ETrue;
   735 						iIsFSVideoViewActivating = ETrue;
   733 						iFullscreenViewActivated = ETrue;
   736 						iFullscreenViewActivated = ETrue;
       
   737 						iGlxGridViewObserver.HandleGridEventsL(EGlxCmdPlay) ;
   734 						iIsFSVideoViewActivating = EFalse;
   738 						iIsFSVideoViewActivating = EFalse;
   735 						iGlxGridViewObserver.HandleGridEventsL(EGlxCmdPlay) ;
       
   736 						}
   739 						}
   737 					}
   740 					}
   738 				else
   741 				else
   739 					{
   742 					{
   740 					iFullscreenViewActivated = ETrue;
   743 					iFullscreenViewActivated = ETrue;
   929         break;
   932         break;
   930        }
   933        }
   931 	}
   934 	}
   932 
   935 
   933 // ---------------------------------------------------------------------------
   936 // ---------------------------------------------------------------------------
   934 // HarvestingUpdated
   937 // HandleMMCInsertionL
   935 // 
   938 // 
   936 // ---------------------------------------------------------------------------
   939 // ---------------------------------------------------------------------------
   937 //
   940 void CGlxGridViewContainer::HandleMMCInsertionL()
   938 void CGlxGridViewContainer::HarvestingUpdated( 
       
   939                 HarvesterEventObserverType HarvestingUpdated, 
       
   940                 HarvesterEventState aHarvesterEventState,
       
   941                 TInt aItemsLeft )
       
   942     {
   941     {
   943     TRACER("CGlxGridViewContainer::HarvestingUpdated()");
   942     TRACER("CGlxGridViewContainer::HandleMMCInsertionL()");
   944     GLX_LOG_INFO1("HarvestingUpdated = %d",HarvestingUpdated);
   943     iGlxGridViewObserver.HandleGridEventsL(EAknSoftkeyClose);
   945     GLX_LOG_INFO1("aHarvesterEventState = %d",aHarvesterEventState);
   944     }
   946     GLX_LOG_INFO1("aItemsLeft = %d",aItemsLeft);
   945 
   947     if(HarvestingUpdated == EHEObserverTypeMMC)
   946 // ---------------------------------------------------------------------------
   948         {
   947 // HandleMMCRemovalL
   949         iGlxGridViewObserver.HandleGridEventsL(EAknSoftkeyClose);
   948 // 
   950         }
   949 // ---------------------------------------------------------------------------
       
   950 void CGlxGridViewContainer::HandleMMCRemovalL()
       
   951     {
       
   952     TRACER("CGlxGridViewContainer::HandleMMCRemovalL()");
       
   953     iGlxGridViewObserver.HandleGridEventsL(EAknSoftkeyExit);
   951     }
   954     }
   952 //end of file
   955 //end of file