photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerback.h
changeset 0 4e91876724a2
child 13 71da52165949
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:    Back command handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef C_GLXCOMMANDHANDLERBACK_H
       
    22 #define C_GLXCOMMANDHANDLERBACK_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <glxcommandhandler.h>
       
    27 
       
    28 
       
    29 // FORWARD DECLARATION
       
    30 class MGlxMediaListProvider;
       
    31 class MMPXCollectionUtility;
       
    32 class MMPXViewUtility;
       
    33 class CGlxNavigationalState;
       
    34 
       
    35   
       
    36 class CGlxBackServiceWrapper;
       
    37 
       
    38 class CAknAppUi;
       
    39 /**
       
    40  * @class CGlxCommandHandlerBack
       
    41  *
       
    42  * Command handler that either takes you back to the previously
       
    43  * active view or one step back in the UI hierarchy
       
    44  *
       
    45  */
       
    46 NONSHARABLE_CLASS (CGlxCommandHandlerBack)
       
    47     : public CGlxCommandHandler
       
    48 	{
       
    49 private:
       
    50 
       
    51 	enum TGlxBackCommandId	
       
    52     {
       
    53     EGlxCmdBack,
       
    54     EGlxCmdPreviousView,
       
    55     EGlxCmdContainerPreviousView,
       
    56     };
       
    57 
       
    58 public:
       
    59 
       
    60 	/**
       
    61 	 * Create Command handler for going back one step within the
       
    62 	 * UI Hierarchy
       
    63 	 * 
       
    64 	 * @param aMediaListProvider media list owner
       
    65 	 */
       
    66 	IMPORT_C static CGlxCommandHandlerBack* NewBackCommandHandlerL();
       
    67 	
       
    68 	/**
       
    69 	 * Create Command handler for going back one view when the
       
    70 	 * current view is outside UI Hierarchy
       
    71 	 * 
       
    72 	 * @param aMediaListProvider media list owner
       
    73 	 */							
       
    74 	IMPORT_C static CGlxCommandHandlerBack* NewPreviousViewCommandHandlerL( 	
       
    75 								MGlxMediaListProvider* aMediaListProvider = NULL);
       
    76 			    
       
    77 	/**
       
    78 	 * Create Command handler for checkig whether to go back one view or two view
       
    79 	 * when the current view is outside UI Hierarchy 
       
    80 	 * 
       
    81 	 * @param aMediaListProvider media list owner
       
    82 	 * @param aPrevViewId previous view id
       
    83 	 */							
       
    84 	IMPORT_C static CGlxCommandHandlerBack* NewContainerPreviousViewCommandHandlerL( 	
       
    85 								MGlxMediaListProvider* aMediaListProvider = NULL, 
       
    86 								TInt aPrevViewId = 0 );
       
    87 
       
    88 	/** Destructor */
       
    89 	IMPORT_C ~CGlxCommandHandlerBack();
       
    90     
       
    91 private:
       
    92 
       
    93     /**
       
    94      * Two-phase constructor
       
    95 	 *
       
    96 	 * @param aCommandId Command id for command handler
       
    97 	 * @param aMediaListProvider media list owner
       
    98 	 * @param aPrevViewId previous view id
       
    99 	 */
       
   100 	static CGlxCommandHandlerBack* NewL(
       
   101 							TInt aCommandId, 
       
   102 							MGlxMediaListProvider* aMediaListProvider,
       
   103 							TInt aPrevViewId );
       
   104 	    
       
   105     /** Second phase constructor */
       
   106 	void ConstructL(TBool aIsContainerList);
       
   107 
       
   108     /** Constructor */
       
   109 	CGlxCommandHandlerBack(MGlxMediaListProvider* aMediaListProvider,
       
   110 							TInt aPrevViewId );
       
   111      
       
   112     // This API to be removed after testing with migration is over 
       
   113 	/**
       
   114 	 * check if deletion of container need to be checked
       
   115 	 */ 
       
   116 	// TBool CheckContainerDeletion() const;
       
   117 	
       
   118 public: // From MGlxCommandHandler
       
   119 
       
   120 	/**
       
   121 	 * Execute the command, if applicable
       
   122 	 * @param aCommand The command to handle
       
   123 	 * @return ETrue iff command was handled
       
   124 	 */
       
   125 	TBool ExecuteL( TInt aCommandId);
       
   126 
       
   127 	/**
       
   128 	 * Modify a menu before it is displayed.
       
   129 	 * @param aResourceId The resource ID of the menu
       
   130 	 * @param aMenuPane The in-memory representation of the menu pane
       
   131 	 */
       
   132 	void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
       
   133 	
       
   134 	/**
       
   135 	 * Called when the owning view is activated
       
   136 	 * @param aViewId The ID of the view
       
   137 	 */
       
   138 	void DoActivateL(TInt aViewId);
       
   139 
       
   140 	/**
       
   141 	 * Called when the owning view is deactivated
       
   142 	 */
       
   143 	void Deactivate();
       
   144 	
       
   145 	/**
       
   146 	 * Offers key events to the command handler
       
   147 	 * @param aKeyEvent The key event. 
       
   148 	 * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown
       
   149 	 * @return Indicates whether or not the key event was used by this control. EKeyWasNotConsumed or EKeyWasConsumed
       
   150 	 */
       
   151 	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
       
   152 
       
   153 	/**
       
   154 	 * Perform any actions needed before the options menu is displayed.
       
   155 	 * The view calling this must first arrange a wait dialog to be displayed, as this operation may take
       
   156 	 * a long time to complete
       
   157 	 */
       
   158 	void PreDynInitMenuPaneL( TInt aResourceId );
       
   159 	
       
   160     /**
       
   161      * See @ref MGlxCommandHandler::GetRequiredAttributesL
       
   162      * No implementation required
       
   163      */
       
   164     void GetRequiredAttributesL(RArray< TMPXAttribute >& /*aAttributes*/,
       
   165                                 TBool /*aFilterUsingSelection*/,
       
   166                                 TBool /*aFilterUsingCommandId*/, 
       
   167                                 TInt /*aCommandId*/) const {}
       
   168 
       
   169 
       
   170 private: // data
       
   171 
       
   172     /** Provider of media list */
       
   173     MGlxMediaListProvider* iMediaListProvider;
       
   174     
       
   175     /** Back functionality that command handler need to execute */
       
   176     TInt iCurrentCommandId;
       
   177         
       
   178     //Previous view id to be checked 
       
   179     TInt iPrevViewId;
       
   180     
       
   181     // Navigational state is stored here
       
   182     CGlxNavigationalState* iNavigationalState;
       
   183    
       
   184     CGlxBackServiceWrapper* iBSWrapper;
       
   185     
       
   186     //MMPXCollectionUtility* iCollectionUtility;
       
   187 
       
   188     /**
       
   189      * Check for the view activation and avoid previous view activation
       
   190      * till the view activation is called on back
       
   191      */
       
   192     TBool iIsViewActivated;
       
   193     
       
   194     
       
   195     /// The AppUI. Not owned
       
   196     CAknAppUi* iAppUi;
       
   197 	};
       
   198 
       
   199 #endif // C_GLXCOMMANDHANDLERBACK_H