photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleropen.cpp
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    Launch help application with appropriate help context
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "glxcommandhandleropen.h"
       
    22 #include <avkon.hrh>
       
    23 #include <mglxmedialist.h>
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // Two-phased constructor.
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 EXPORT_C CGlxCommandHandlerOpen* CGlxCommandHandlerOpen::NewL(MGlxMediaListProvider* aMediaListProvider)
       
    30     {
       
    31     CGlxCommandHandlerOpen* self = new ( ELeave ) CGlxCommandHandlerOpen(aMediaListProvider);
       
    32     CleanupStack::PushL( self );
       
    33     self->ConstructL();
       
    34     CleanupStack::Pop( self );
       
    35     return self;
       
    36     }
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // C++ default constructor can NOT contain any code, that
       
    40 // might leave.
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 CGlxCommandHandlerOpen::CGlxCommandHandlerOpen(MGlxMediaListProvider* aMediaListProvider)
       
    44 	: CGlxMediaListCommandHandler(aMediaListProvider)
       
    45     {
       
    46     // Do nothing
       
    47     }
       
    48  
       
    49 // ---------------------------------------------------------------------------
       
    50 // Symbian 2nd phase constructor can leave.
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 void CGlxCommandHandlerOpen::ConstructL()
       
    54     {
       
    55     
       
    56     iUiUtility = CGlxUiUtility::UtilityL();
       
    57     
       
    58    	// Add supported command
       
    59    	TCommandInfo info(EAknCmdOpen);
       
    60     info.iCategoryFilter = EMPXVideo;
       
    61     info.iCategoryRule = TCommandInfo::EForbidAll;
       
    62     info.iDisallowSystemItems = EFalse;    
       
    63    	AddCommandL( info );
       
    64    	}
       
    65 
       
    66     
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // Destructor
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 EXPORT_C CGlxCommandHandlerOpen::~CGlxCommandHandlerOpen()
       
    73     { 
       
    74     if(iUiUtility)
       
    75         {
       
    76         iUiUtility->Close();
       
    77         }
       
    78     }
       
    79         
       
    80 // -----------------------------------------------------------------------------
       
    81 // DoExecute - the relevant action for the command id
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 TBool CGlxCommandHandlerOpen::DoExecuteL(TInt /*aCommandId*/,MGlxMediaList& /*aList*/)
       
    85     {
       
    86      return EFalse;      	 
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 // DoActivateL
       
    91 // -----------------------------------------------------------------------------
       
    92 //		
       
    93 void CGlxCommandHandlerOpen::DoActivateL( TInt /*aViewId*/ )
       
    94 	{
       
    95 	// No Imp.
       
    96 	}
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // DoIsDisabled
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 TBool CGlxCommandHandlerOpen::DoIsDisabled(TInt /*aCommandId*/, 
       
   103                                         MGlxMediaList& aList) const 
       
   104     {    
       
   105     // Disable if device supports touch or 
       
   106     // If there are no items in the medialist or
       
   107     // If there are items that are marked.
       
   108     
       
   109   	return ( iUiUtility->IsPenSupported() || 
       
   110   	        aList.Count() == 0 || aList.SelectionCount()>0 );
       
   111    	}