photosgallery/viewframework/dataprovider/src/glxmulmodelproviderbase.cpp
branchRCL_3
changeset 24 ea65f74e6de4
parent 23 b023a8d2866a
equal deleted inserted replaced
23:b023a8d2866a 24:ea65f74e6de4
    18 
    18 
    19 
    19 
    20 
    20 
    21 #include "glxmulmodelproviderbase.h"
    21 #include "glxmulmodelproviderbase.h"
    22 
    22 
    23 #include <e32err.h>
       
    24 #include <alf/alfenv.h>
    23 #include <alf/alfenv.h>
    25 #include <alf/alfevent.h>
    24 #include <alf/alfevent.h>
    26 #include <alf/ialfwidgetfactory.h>
    25 #include <alf/ialfwidgetfactory.h>
    27 #include <alf/alfwidgetenvextension.h>
    26 #include <alf/alfwidgetenvextension.h>
    28 //#include <osn/ustring.h>
       
    29 #include <mul/imulwidget.h>
    27 #include <mul/imulwidget.h>
    30 #include <mul/mulevent.h>
    28 #include <mul/mulevent.h>
    31 #include <mul/mulvisualitem.h>
    29 #include <mul/mulvisualitem.h>
       
    30 #include <mul/imulcoverflowwidget.h>               // An interface for Multimedia coverflow Widget
    32 #include <glxlog.h>  //Logging
    31 #include <glxlog.h>  //Logging
    33 #include <glxtracer.h>
    32 #include <glxtracer.h>
    34 #include "glxbinding.h"
       
    35 #include "glxcommandbindingutility.h"
       
    36 #include <glxnavigationalstate.h>
    33 #include <glxnavigationalstate.h>
    37 #include <glxnavigationalstatedefs.h>
    34 #include <glxnavigationalstatedefs.h>
    38 
    35 
    39 #include <data_caging_path_literals.hrh>// for KDC_APP_RESOURCE_DIR
    36 #include <data_caging_path_literals.hrh>// for KDC_APP_RESOURCE_DIR
    40 #include <glxuiutilities.rsg>
    37 #include <glxuiutilities.rsg>
    41 #include <glxgeneraluiutilities.h>
    38 #include <glxgeneraluiutilities.h>
    42 #include <glxtexturemanager.h>
    39 #include <glxtexturemanager.h>
    43 #include <glxicons.mbg>
    40 #include <glxicons.mbg>
    44 #include <glxuistd.h>
    41 #include <glxuistd.h>
    45 #include <mul/imulcoverflowwidget.h>               // An interface for Multimedia coverflow Widget
       
    46 #include "glxdrmgiftexturecreator.h"
    42 #include "glxdrmgiftexturecreator.h"
       
    43 #include "glxbinding.h"
       
    44 #include "glxcommandbindingutility.h"
    47 
    45 
    48 using namespace Alf;
    46 using namespace Alf;
    49 
    47 
    50 static const char* const KListWidget = "ListWidget";
    48 static const char* const KListWidget = "ListWidget";
    51 static const char* const KGridWidget = "GridWidget";
    49 static const char* const KGridWidget = "GridWidget";
    52 static const char* const KCoverFlowWidget = "CoverflowWidget";
    50 static const char* const KCoverFlowWidget = "CoverflowWidget";
    53 
       
    54 //@todo to be uncommented when using command binding
       
    55 //#include "glxboundcommand.h"
       
    56 
    51 
    57 // ----------------------------------------------------------------------------
    52 // ----------------------------------------------------------------------------
    58 // BaseConstructL
    53 // BaseConstructL
    59 // ----------------------------------------------------------------------------
    54 // ----------------------------------------------------------------------------
    60 //
    55 //
   187 	{
   182 	{
   188 	TRACER("CGlxMulModelProviderBase::offerEvent");
   183 	TRACER("CGlxMulModelProviderBase::offerEvent");
   189 	AlfEventStatus response = EEventNotHandled;
   184 	AlfEventStatus response = EEventNotHandled;
   190 	if ( aEvent.IsCustomEvent() )
   185 	if ( aEvent.IsCustomEvent() )
   191 		{
   186 		{
       
   187 		GLX_LOG_INFO1("CGlxMulModelProviderBase::offerEvent() aEvent.CustomParameter(%d)", aEvent.CustomParameter());    
   192 		switch ( aEvent.CustomParameter() ) 
   188 		switch ( aEvent.CustomParameter() ) 
   193 			{
   189 			{
   194 			case KAlfActionIdDeviceLayoutChanged:
   190 			case KAlfActionIdDeviceLayoutChanged:
   195 				{
   191 				{
   196 				HandleOrientationChanged();
   192 				HandleOrientationChanged();
   204 					HandleFocusChanged( FocusIndex(), iPreviousFocusIndex );
   200 					HandleFocusChanged( FocusIndex(), iPreviousFocusIndex );
   205 					}
   201 					}
   206 				response = EEventHandled;
   202 				response = EEventHandled;
   207 				}
   203 				}
   208 				break;
   204 				break;
   209 			default:
   205             case Alf::ETypeItemRemoved:
   210 				break;
   206                 {
   211 			}
   207                 GLX_LOG_INFO("CGlxMulModelProviderBase::offerEvent - ETypeItemRemoved!");
       
   208                 CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();
       
   209                 CleanupClosePushL(*uiUtility);
       
   210                 if (iModel->Count() == 0 && UString(KCoverFlowWidget)
       
   211                         == UString(iWidget.widgetName())
       
   212                         && iNavigationalState->ViewingMode()
       
   213                                 == NGlxNavigationalState::EView
       
   214                         && uiUtility->GetForegroundStatus())
       
   215                     {
       
   216                     uiUtility->SetViewNavigationDirection(
       
   217                             EGlxNavigationBackwards);
       
   218 
       
   219                     iNavigationalState->ActivatePreviousViewL();
       
   220                     response = EEventHandled;
       
   221                     }
       
   222                 CleanupStack::PopAndDestroy(uiUtility);
       
   223                 }
       
   224                 break;
       
   225             default:
       
   226                 break;
       
   227             }
   212 		}
   228 		}
   213 	return response;
   229 	return response;
   214 	}
   230 	}
   215 
   231 
   216 // ----------------------------------------------------------------------------
   232 // ----------------------------------------------------------------------------
   304         {
   320         {
   305         TBool drm = EFalse;
   321         TBool drm = EFalse;
   306         TGlxMediaGeneralRightsValidity isValid = EGlxDrmRightsValidityUnknown;
   322         TGlxMediaGeneralRightsValidity isValid = EGlxDrmRightsValidityUnknown;
   307         if (aMedia.GetDrmProtected(drm))
   323         if (aMedia.GetDrmProtected(drm))
   308             {
   324             {
   309             GLX_DEBUG1("CGlxMulModelProviderBase::SetDataT GetDrmValidity");
       
   310             aMedia.GetDrmValidity(isValid);
   325             aMedia.GetDrmValidity(isValid);
       
   326             GLX_DEBUG2("CGlxMulModelProviderBase::SetDataT DrmValidity(%d)", isValid);
   311             }
   327             }
   312         TInt frameCount;
   328         TInt frameCount;
   313         aMedia.GetFrameCount(frameCount);
   329         aMedia.GetFrameCount(frameCount);
   314         
   330         GLX_DEBUG2("CGlxMulModelProviderBase::SetDataT framecount=%d", frameCount);
   315         //Create the DRM gif texture intance only if the DRM gif image is
   331         //Create the DRM gif texture intance only if the DRM gif image is
   316         //valid and focused
   332         //valid and focused
   317         if (frameCount > 1 && drm && isValid == EGlxDrmRightsValid)
   333         if (frameCount > 1 && drm && isValid == EGlxDrmRightsValid)
   318             {
   334             {
   319             if (!iDrmGifTextureCreator)
   335             if (!iDrmGifTextureCreator)
   442 //    
   458 //    
   443 void CGlxMulModelProviderBase::RemoveItems( TInt aIndex, TInt aCount )
   459 void CGlxMulModelProviderBase::RemoveItems( TInt aIndex, TInt aCount )
   444     {
   460     {
   445     TRACER("CGlxMulModelProviderBase::RemoveItems");
   461     TRACER("CGlxMulModelProviderBase::RemoveItems");
   446     // RemoveItems does not throw according to model documentation
   462     // RemoveItems does not throw according to model documentation
       
   463     GLX_LOG_INFO2("CGlxMulModelProviderBase::RemoveItems() aIndex(%d), aCount(%d)", aIndex, aCount);    
   447     iModel->Remove( aIndex, aCount );
   464     iModel->Remove( aIndex, aCount );
   448     }    
   465     }    
   449 
   466 
   450 // ----------------------------------------------------------------------------
   467 // ----------------------------------------------------------------------------
   451 // SetFocusIndex
   468 // SetFocusIndex