photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerrename.cpp
branchRCL_3
changeset 25 191387a8b767
parent 18 bcb43dc84c44
child 57 ea65f74e6de4
equal deleted inserted replaced
22:2dac0fdba72b 25:191387a8b767
    49 // ---------------------------------------------------------------------------
    49 // ---------------------------------------------------------------------------
    50 // Two-phased constructor.
    50 // Two-phased constructor.
    51 // ---------------------------------------------------------------------------
    51 // ---------------------------------------------------------------------------
    52 //
    52 //
    53 EXPORT_C CGlxCommandHandlerRename* CGlxCommandHandlerRename::NewL(
    53 EXPORT_C CGlxCommandHandlerRename* CGlxCommandHandlerRename::NewL(
    54         MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem )
    54 		MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem,
    55     {
    55 		const TDesC& aFileName)
    56     CGlxCommandHandlerRename* self = new ( ELeave ) CGlxCommandHandlerRename
    56 	{
    57     	( aMediaListProvider, aHasToolbarItem );
    57 	CGlxCommandHandlerRename* self = new (ELeave) CGlxCommandHandlerRename(
    58     CleanupStack::PushL( self );
    58 			aMediaListProvider, aHasToolbarItem);
    59     self->ConstructL();
    59 	CleanupStack::PushL(self);
    60     CleanupStack::Pop( self );
    60 	self->ConstructL(aFileName);
    61     return self;
    61 	CleanupStack::Pop(self);
    62     }
    62 	return self;
       
    63 	}
    63 
    64 
    64 // ---------------------------------------------------------------------------
    65 // ---------------------------------------------------------------------------
    65 // C++ default constructor can NOT contain any code, that
    66 // C++ default constructor can NOT contain any code, that
    66 // might leave.
    67 // might leave.
    67 // ---------------------------------------------------------------------------
    68 // ---------------------------------------------------------------------------
    71 	: CGlxMpxCommandCommandHandler( aMediaListProvider, aHasToolbarItem )
    72 	: CGlxMpxCommandCommandHandler( aMediaListProvider, aHasToolbarItem )
    72     {
    73     {
    73     // Do nothing
    74     // Do nothing
    74     }
    75     }
    75  
    76  
       
    77 
    76 // ---------------------------------------------------------------------------
    78 // ---------------------------------------------------------------------------
    77 // Symbian 2nd phase constructor can leave.
    79 // Symbian 2nd phase constructor can leave.
    78 // ---------------------------------------------------------------------------
    80 // ---------------------------------------------------------------------------
    79 //
    81 //
    80 void CGlxCommandHandlerRename::ConstructL()
    82 void CGlxCommandHandlerRename::ConstructL(const TDesC& aFileName)
    81     {
    83 	{
    82     iRenameText = HBufC::NewL( KNameMaxLength );
    84 	iRenameText = HBufC::NewL(KNameMaxLength);
    83 
    85 
    84     // Load resource file
    86 	iResourceOffset = CCoeEnv::Static()->AddResourceFileL(aFileName);
    85 	TParse parse;
    87 
    86     parse.Set( KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL );
    88 	// Add supported command
    87     TFileName resourceFile;
    89 	TCommandInfo info(EGlxCmdRename);
    88     resourceFile.Append( parse.FullName() );
    90 	// This setup disables the command if a static item is focused,
    89     CGlxResourceUtilities::GetResourceFilenameL( resourceFile );  
    91 	// if the view is empty or if more than one item is selected.
    90    	iResourceOffset = CCoeEnv::Static()->AddResourceFileL( resourceFile );
    92 	info.iMinSelectionLength = 1;
    91 
    93 	info.iMaxSelectionLength = 1;
    92    	// Add supported command
    94 	// Filter out system items
    93    	TCommandInfo info( EGlxCmdRename );
    95 	info.iDisallowSystemItems = ETrue;
    94    	// This setup disables the command if a static item is focused,
    96 	// Allow animated GIFs to be renamed
    95    	// if the view is empty or if more than one item is selected.
    97 	info.iStopAnimationForExecution = ETrue;
    96     info.iMinSelectionLength = 1;
    98 
    97     info.iMaxSelectionLength = 1;
    99 	AddCommandL(info);
    98     // Filter out system items
   100 
    99     info.iDisallowSystemItems = ETrue;
   101 	iErrorCallback = new (ELeave) CAsyncCallBack(TCallBack(HandleErrorL, this),
   100     // Allow animated GIFs to be renamed
   102 			CActive::EPriorityStandard);
   101     info.iStopAnimationForExecution = ETrue;
   103 	}
   102     
       
   103    	AddCommandL( info );
       
   104 
       
   105     iErrorCallback = new (ELeave) CAsyncCallBack( TCallBack( HandleErrorL, this ), 
       
   106                                                   CActive::EPriorityStandard );
       
   107     }
       
   108 
   104 
   109 // ---------------------------------------------------------------------------
   105 // ---------------------------------------------------------------------------
   110 // Destructor
   106 // Destructor
   111 // ---------------------------------------------------------------------------
   107 // ---------------------------------------------------------------------------
   112 //
   108 //