photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerslideshow.cpp
branchRCL_3
changeset 25 191387a8b767
parent 22 2dac0fdba72b
child 47 f9e827349359
equal deleted inserted replaced
22:2dac0fdba72b 25:191387a8b767
    54 // ---------------------------------------------------------------------------
    54 // ---------------------------------------------------------------------------
    55 // Two-phased constructor.
    55 // Two-phased constructor.
    56 // ---------------------------------------------------------------------------
    56 // ---------------------------------------------------------------------------
    57 //
    57 //
    58 EXPORT_C CGlxCommandHandlerSlideshow* CGlxCommandHandlerSlideshow::NewL(
    58 EXPORT_C CGlxCommandHandlerSlideshow* CGlxCommandHandlerSlideshow::NewL(
    59     MGlxMediaListProvider* aMediaListProvider, TBool aStepBack, TBool aHasToolbarItem )
    59 		MGlxMediaListProvider* aMediaListProvider, TBool aStepBack,
    60     {
    60 		TBool aHasToolbarItem, const TDesC& aFileName)
    61     TRACER( "CGlxCommandHandlerSlideshow::NewL" );
    61 	{
    62     CGlxCommandHandlerSlideshow* self = new ( ELeave )
    62 	TRACER( "CGlxCommandHandlerSlideshow::NewL" );
    63     	CGlxCommandHandlerSlideshow(aMediaListProvider, aStepBack, aHasToolbarItem);
    63 	CGlxCommandHandlerSlideshow* self =
    64     CleanupStack::PushL( self );
    64 			new (ELeave) CGlxCommandHandlerSlideshow(aMediaListProvider,
    65     self->ConstructL();
    65 					aStepBack, aHasToolbarItem);
    66     CleanupStack::Pop( self );
    66 	CleanupStack::PushL(self);
    67     return self;
    67 	self->ConstructL(aFileName);
    68     }
    68 	CleanupStack::Pop(self);
       
    69 	return self;
       
    70 	}
    69 
    71 
    70 // ---------------------------------------------------------------------------
    72 // ---------------------------------------------------------------------------
    71 // C++ default constructor can NOT contain any code, that
    73 // C++ default constructor can NOT contain any code, that
    72 // might leave.
    74 // might leave.
    73 // ---------------------------------------------------------------------------
    75 // ---------------------------------------------------------------------------
    77     : CGlxMediaListCommandHandler(aMediaListProvider, aHasToolbarItem), iStepBack(aStepBack)
    79     : CGlxMediaListCommandHandler(aMediaListProvider, aHasToolbarItem), iStepBack(aStepBack)
    78     {
    80     {
    79     // Do nothing
    81     // Do nothing
    80     }
    82     }
    81  
    83  
       
    84 
    82 // ---------------------------------------------------------------------------
    85 // ---------------------------------------------------------------------------
    83 // Symbian 2nd phase constructor can leave.
    86 // Symbian 2nd phase constructor can leave.
    84 // ---------------------------------------------------------------------------
    87 // ---------------------------------------------------------------------------
    85 //
    88 //
    86 void CGlxCommandHandlerSlideshow::ConstructL()
    89 void CGlxCommandHandlerSlideshow::ConstructL(const TDesC& aFileName)
    87     {
    90 	{
    88     TRACER( "CGlxCommandHandlerSlideshow::ConstructL" );
    91 	TRACER( "CGlxCommandHandlerSlideshow::ConstructL" );
    89     
    92 
    90     // Get a handle 
    93 	// Get a handle 
    91     iUiUtility = CGlxUiUtility::UtilityL();
    94 	iUiUtility = CGlxUiUtility::UtilityL();
    92 
    95 
    93     // Load resource file
    96 	iResourceOffset = CCoeEnv::Static()->AddResourceFileL(aFileName);
    94 	TParse parse;
    97 
    95     parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL);
    98 	iShowInToolbar = ETrue;
    96     TFileName resourceFile;
    99 
    97     resourceFile.Append(parse.FullName());
   100 	// Add supported commands with filter fields
    98     CGlxResourceUtilities::GetResourceFilenameL(resourceFile);  
   101 	// Play slideshow forwards
    99    	iResourceOffset = CCoeEnv::Static()->AddResourceFileL( resourceFile );
   102 	TCommandInfo info(EGlxCmdSlideshowPlay);
   100 
   103 	// Disable for static items and dont enable empty slideshow
   101     iShowInToolbar = ETrue;
   104 	info.iMinSelectionLength = 1;
   102 
   105 	// Enable only for albums that have more than one item
   103    	// Add supported commands with filter fields
   106 	info.iMinSlideshowPlayableContainedItemCount = 1;
   104    	// Play slideshow forwards
   107 	// Disable for animated GIFs
   105    	TCommandInfo info( EGlxCmdSlideshowPlay );
   108 	info.iDisallowAnimatedGIFs = ETrue;
   106    	// Disable for static items and dont enable empty slideshow
   109 	// Disable DRM protected content
   107     info.iMinSelectionLength = 1;
   110 	info.iDisallowDRM = ETrue;
   108    	// Enable only for albums that have more than one item
   111 	// Note: cannot just require all to be images as user can also start 
   109     info.iMinSlideshowPlayableContainedItemCount = 1;
   112 	// slideshow for a whole album from list view and in that case
   110     // Disable for animated GIFs
   113 	// selection contains a container
   111     info.iDisallowAnimatedGIFs = ETrue;
       
   112     // Disable DRM protected content
       
   113     info.iDisallowDRM = ETrue;
       
   114     // Note: cannot just require all to be images as user can also start 
       
   115     // slideshow for a whole album from list view and in that case
       
   116     // selection contains a container
       
   117 	// Disable all videos
   114 	// Disable all videos
   118 	TMPXGeneralCategory categoryFilter = EMPXVideo;
   115 	TMPXGeneralCategory categoryFilter = EMPXVideo;
   119 	// Disable the command for videos
   116 	// Disable the command for videos
   120 	TCommandInfo::TCategoryRule categoryRule = TCommandInfo::EForbidAll;
   117 	TCommandInfo::TCategoryRule categoryRule = TCommandInfo::EForbidAll;
   121 	info.iCategoryFilter = categoryFilter;
   118 	info.iCategoryFilter = categoryFilter;
   122 	info.iCategoryRule = categoryRule;
   119 	info.iCategoryRule = categoryRule;
   123    	AddCommandL( info );
   120 	AddCommandL(info);
   124    	
   121 
   125     // new info to get the default filters
   122 	// new info to get the default filters
   126    	TCommandInfo info_show_always( EGlxCmdSlideshowSettings );
   123 	TCommandInfo info_show_always(EGlxCmdSlideshowSettings);
   127    	// Disable for empty views and views with only static items
   124 	// Disable for empty views and views with only static items
   128     info_show_always.iMinSelectionLength = 1;
   125 	info_show_always.iMinSelectionLength = 1;
   129    	// slideshow settings
   126 	// slideshow settings
   130    	AddCommandL( info_show_always );
   127 	AddCommandL(info_show_always);
   131 
   128 
   132    	// Menu
   129 	// Menu
   133    	info_show_always.iCommandId = EGlxCmdSlideshow;
   130 	info_show_always.iCommandId = EGlxCmdSlideshow;
   134    	AddCommandL( info_show_always );
   131 	AddCommandL(info_show_always);
   135 
   132 
   136     // Dummy command to get UPnP state
   133 	// Dummy command to get UPnP state
   137     TCommandInfo infoUpnpState( EGlxCmdShowViaUpnpStateChanged );
   134 	TCommandInfo infoUpnpState(EGlxCmdShowViaUpnpStateChanged);
   138     AddCommandL( infoUpnpState );
   135 	AddCommandL(infoUpnpState);
   139 
   136 
   140    	// Buffer
   137 	// Buffer
   141    	iBufFlat = CBufFlat::NewL( KShwDefaultBufferSize );
   138 	iBufFlat = CBufFlat::NewL(KShwDefaultBufferSize);
   142 	}
   139 	}
   143 
   140 
   144 // ---------------------------------------------------------------------------
   141 // ---------------------------------------------------------------------------
   145 // Destructor
   142 // Destructor
   146 // ---------------------------------------------------------------------------
   143 // ---------------------------------------------------------------------------
   276 			// before & after the Settings Dialog (which is uses the Akn 
   273 			// before & after the Settings Dialog (which is uses the Akn 
   277 			// framework) is activated & deactivated respectively.
   274 			// framework) is activated & deactivated respectively.
   278 			// Activating and deactivating the HUI within the Settings 
   275 			// Activating and deactivating the HUI within the Settings 
   279 			// Dialog class will cause a Cone 8 panic.
   276 			// Dialog class will cause a Cone 8 panic.
   280 			
   277 			
       
   278 			iAvkonAppUi->ProcessCommandL(EGlxCmdDialogLaunched);
       
   279 			
   281 			// hide HUI display
   280 			// hide HUI display
   282 			CGlxUiUtility::HideAlfDisplayL();
   281 			CGlxUiUtility::HideAlfDisplayL();
   283 				{
   282 				{
   284 				MMPXViewUtility* viewUtility = MMPXViewUtility::UtilityL();
   283 				MMPXViewUtility* viewUtility = MMPXViewUtility::UtilityL();
   285 				CleanupClosePushL(*viewUtility);
   284 				CleanupClosePushL(*viewUtility);