photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwbase.h
changeset 0 4e91876724a2
child 25 191387a8b767
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:    AIW command handler base class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_GLXCOMMANDHANDLERAIWBASE_H
       
    21 #define C_GLXCOMMANDHANDLERAIWBASE_H
       
    22 
       
    23 #include <AiwCommon.h>
       
    24 #include <glxmedialistcommandhandler.h>
       
    25 #include <glxmedialistiterator.h>
       
    26 
       
    27 class CGlxAttributeContext;
       
    28 class CGlxAiwServiceHandler;
       
    29 class CGlxMedia;
       
    30 class TGlxMedia;
       
    31 class MGlxMediaList;
       
    32 class CGlxAttributeRetriever;
       
    33 class CAknAppUi;
       
    34 
       
    35 /**
       
    36  *  CGlxCommandHandlerAiwBase
       
    37  *
       
    38  *  Base class for AIW command handlers
       
    39  *
       
    40  *  @lib glxcommoncommandhandlers.lib
       
    41  */
       
    42 NONSHARABLE_CLASS (CGlxCommandHandlerAiwBase)
       
    43     : public CGlxMediaListCommandHandler, 
       
    44       public MAiwNotifyCallback
       
    45     {
       
    46 public:
       
    47 	/** Destructor */
       
    48 	virtual ~CGlxCommandHandlerAiwBase();
       
    49 
       
    50 public: // From MAiwNotifyCallback
       
    51     virtual TInt HandleNotifyL(
       
    52         TInt aCmdId,
       
    53         TInt aEventId,
       
    54         CAiwGenericParamList& aEventParamList,
       
    55         const CAiwGenericParamList& aInParamList);
       
    56             
       
    57 protected: // From CGlxMediaListCommandHandler
       
    58     virtual TBool BypassFiltersForExecute() const;
       
    59     virtual TBool BypassFiltersForMenu() const;
       
    60     virtual TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList);
       
    61     virtual void DoDynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
       
    62 	virtual void PreDynInitMenuPaneL( TInt aResourceId );
       
    63     virtual void DoActivateL(TInt aViewId);
       
    64     virtual void Deactivate();
       
    65     
       
    66 protected: // New functions
       
    67     /** 
       
    68      * Constructor 
       
    69      * @param aMediaListProvider The media list owner, used by 
       
    70      *          CGlxMediaListCommandHandler
       
    71      * @param aMenuResource The menu resource that the AIW command will be 
       
    72      *          implented in
       
    73      */
       
    74 	CGlxCommandHandlerAiwBase(MGlxMediaListProvider* aMediaListProvider, 
       
    75 	                          TInt aMenuResource);
       
    76 
       
    77     /** Second phase constructor */
       
    78 	void ConstructL();
       
    79 	
       
    80     /**
       
    81      *  This appends a Uri and/or a mimetype parameter to the InParams list (see Aiw Service Handler)
       
    82      *  @param aItem - The data source. Used to extract the Uri/mimetype
       
    83      *  @param aAiwServiceHandler - Reference to the CGlxAiwServiceHandler
       
    84      *  @param aAddUri - ETrue to add the Uri, EFalse if not.
       
    85      *  @param aAddMimeType - Etrue to add the mimetype, EFalse if not.
       
    86      */
       
    87     TBool AppendDefaultAiwParameterL(const TGlxMedia& aItem, 
       
    88                                     CGlxAiwServiceHandler& aAiwServiceHandler,
       
    89                                     TBool aAddUri,
       
    90                                     TBool aAddMimeType);
       
    91 
       
    92 	
       
    93 protected: // New functions to be overridden by implementing class
       
    94     /**
       
    95      * Appends one or more parameters to aParamList, to represent aItem. 
       
    96      * aParamList will eventually be passed to Aiw, so the format of these 
       
    97      * parameters should be agreed with AIW.
       
    98      * @param aItem Item to examine
       
    99      * @param aParamList The parameter list to append the new parameter(s) to
       
   100      * @return True iff the parameter could be appended; False otherwise
       
   101      */
       
   102     virtual TBool AppendAiwParameterL(const TGlxMedia& aItem, 
       
   103                                      CGlxAiwServiceHandler& aAiwServiceHandler) = 0;
       
   104     
       
   105     /**
       
   106      * @return The command ID in the menu that AIW will replace
       
   107      */
       
   108     virtual TInt CommandId() const = 0;
       
   109     
       
   110     /**
       
   111      * @return The AIW command implemented
       
   112      */
       
   113     virtual TInt AiwCommandId() const = 0;
       
   114     
       
   115     /**
       
   116      * @return The AIW interest resource for the subclass
       
   117      */
       
   118     virtual TInt AiwInterestResource() const = 0;
       
   119     
       
   120     /**
       
   121      * @return The maximum number of selected items supported
       
   122      */
       
   123     virtual TInt MaxSelectedItems() const;
       
   124 
       
   125     /**
       
   126      * Allow the concrete implementation to do some work on the menu before
       
   127      * passing it to the AIW service handler
       
   128 	 * @param aResourceId The resource ID of the menu
       
   129 	 * @param aMenuPane The in-memory representation of the menu pane
       
   130 	 * @see CGlxMediaListCommandHandler::DoDynInitMenuPaneL
       
   131 	 */
       
   132     virtual void AiwDoDynInitMenuPaneL(TInt aResourceId, 
       
   133         CEikMenuPane* aMenuPane);
       
   134 
       
   135     /**
       
   136      * @return The command space to use for the command
       
   137      */    
       
   138     virtual TInt CommandSpace() const = 0;
       
   139     
       
   140     /**
       
   141      * @param aMenuItemText itemText for menu Item
       
   142      * @param aMenuPane menuPane in which itemText to be searched
       
   143      * @return The AIW commandId for menuItemText
       
   144      */
       
   145     TInt AiwMenuCmdIdL( const TDesC& aMenuItemText, CEikMenuPane* aMenuPane );
       
   146         
       
   147 private:
       
   148     /**
       
   149      * Collates all Aiw parameters needed by iterating through the selected 
       
   150      * items. adding them to an internal array in the aAiwServiceHandler
       
   151      * @param aAiwServiceHandler a reference to the AiwServiceHandler
       
   152      * @return True iff all parameters were available, False otherwise
       
   153      * @see AppendAiwParameterL
       
   154      */
       
   155     TBool GatherAiwParametersL(CGlxAiwServiceHandler& aAiwServiceHandler);
       
   156 
       
   157     /**
       
   158      * Collates all Aiw parameters needed by iterating through the selected 
       
   159      * items adding them directly to the AIW InParams
       
   160      * @param aAiwServiceHandler a reference to the AiwServiceHandler
       
   161      * @return True iff all parameters were available, False otherwise
       
   162      * @see AppendAiwParameterL
       
   163      */
       
   164     TBool RegatherAiwParametersL(CGlxAiwServiceHandler& aAiwServiceHandler);
       
   165     
       
   166     /**
       
   167      * Check whether the AIW item is enabled
       
   168      * @return Whether the AIW item is enabled
       
   169      */
       
   170     TBool AiwItemEnabledL();
       
   171 
       
   172     TBool AppendTextParameterL(const TGlxMedia& aItem,
       
   173                               CGlxAiwServiceHandler& aAiwServiceHandler,
       
   174                               const TDesC& aText,
       
   175                               TGenericParamIdValue aGenericParamIdValue);
       
   176                               
       
   177     /*
       
   178     TBool AppendTextParameterL(CGlxAiwServiceHandler& aAiwServiceHandler,
       
   179                               const TDesC& aText,
       
   180                               TGenericParamIdValue aGenericParamIdValue);
       
   181     */
       
   182 
       
   183 private:
       
   184     /// Menu resource containing iCommandId
       
   185     TInt iMenuResource;
       
   186         
       
   187     /// The AppUI, not owned.
       
   188     CAknAppUi* iAppUi;
       
   189     
       
   190     /// Pointer to the AiwServiceHandler. This is the real CGlxAiwServiceHandler, of which there can only be one instance, Hence the need to wrap
       
   191     /// in this singleton class.
       
   192     CGlxAiwServiceHandler* iAiwServiceHandler;
       
   193     TInt iResourceOffset;
       
   194     };
       
   195 
       
   196 #endif // C_GLXCOMMANDHANDLERAIWBASE_H