photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwbase.h
branchRCL_3
changeset 60 5b3385a43d68
equal deleted inserted replaced
59:8e5f6eea9c9f 60:5b3385a43d68
       
     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      * @param aFileName resource file
       
    79      */
       
    80 	void ConstructL(const TDesC& aFileName);
       
    81 	
       
    82     /**
       
    83      *  This appends a Uri and/or a mimetype parameter to the InParams list (see Aiw Service Handler)
       
    84      *  @param aItem - The data source. Used to extract the Uri/mimetype
       
    85      *  @param aAiwServiceHandler - Reference to the CGlxAiwServiceHandler
       
    86      *  @param aAddUri - ETrue to add the Uri, EFalse if not.
       
    87      *  @param aAddMimeType - Etrue to add the mimetype, EFalse if not.
       
    88      */
       
    89     TBool AppendDefaultAiwParameterL(const TGlxMedia& aItem, 
       
    90                                     CGlxAiwServiceHandler& aAiwServiceHandler,
       
    91                                     TBool aAddUri,
       
    92                                     TBool aAddMimeType);
       
    93 
       
    94 	
       
    95 protected: // New functions to be overridden by implementing class
       
    96     /**
       
    97      * Appends one or more parameters to aParamList, to represent aItem. 
       
    98      * aParamList will eventually be passed to Aiw, so the format of these 
       
    99      * parameters should be agreed with AIW.
       
   100      * @param aItem Item to examine
       
   101      * @param aParamList The parameter list to append the new parameter(s) to
       
   102      * @return True iff the parameter could be appended; False otherwise
       
   103      */
       
   104     virtual TBool AppendAiwParameterL(const TGlxMedia& aItem, 
       
   105                                      CGlxAiwServiceHandler& aAiwServiceHandler) = 0;
       
   106     
       
   107     /**
       
   108      * @return The command ID in the menu that AIW will replace
       
   109      */
       
   110     virtual TInt CommandId() const = 0;
       
   111     
       
   112     /**
       
   113      * @return The AIW command implemented
       
   114      */
       
   115     virtual TInt AiwCommandId() const = 0;
       
   116     
       
   117     /**
       
   118      * @return The AIW interest resource for the subclass
       
   119      */
       
   120     virtual TInt AiwInterestResource() const = 0;
       
   121     
       
   122     /**
       
   123      * @return The maximum number of selected items supported
       
   124      */
       
   125     virtual TInt MaxSelectedItems() const;
       
   126 
       
   127     /**
       
   128      * Allow the concrete implementation to do some work on the menu before
       
   129      * passing it to the AIW service handler
       
   130 	 * @param aResourceId The resource ID of the menu
       
   131 	 * @param aMenuPane The in-memory representation of the menu pane
       
   132 	 * @see CGlxMediaListCommandHandler::DoDynInitMenuPaneL
       
   133 	 */
       
   134     virtual void AiwDoDynInitMenuPaneL(TInt aResourceId, 
       
   135         CEikMenuPane* aMenuPane);
       
   136 
       
   137     /**
       
   138      * @return The command space to use for the command
       
   139      */    
       
   140     virtual TInt CommandSpace() const = 0;
       
   141     
       
   142     /**
       
   143      * @param aMenuItemText itemText for menu Item
       
   144      * @param aMenuPane menuPane in which itemText to be searched
       
   145      * @return The AIW commandId for menuItemText
       
   146      */
       
   147     TInt AiwMenuCmdIdL( const TDesC& aMenuItemText, CEikMenuPane* aMenuPane );
       
   148         
       
   149 private:
       
   150     /**
       
   151      * Collates all Aiw parameters needed by iterating through the selected 
       
   152      * items. adding them to an internal array in the aAiwServiceHandler
       
   153      * @param aAiwServiceHandler a reference to the AiwServiceHandler
       
   154      * @return True iff all parameters were available, False otherwise
       
   155      * @see AppendAiwParameterL
       
   156      */
       
   157     TBool GatherAiwParametersL(CGlxAiwServiceHandler& aAiwServiceHandler);
       
   158 
       
   159     /**
       
   160      * Collates all Aiw parameters needed by iterating through the selected 
       
   161      * items adding them directly to the AIW InParams
       
   162      * @param aAiwServiceHandler a reference to the AiwServiceHandler
       
   163      * @return True iff all parameters were available, False otherwise
       
   164      * @see AppendAiwParameterL
       
   165      */
       
   166     TBool RegatherAiwParametersL(CGlxAiwServiceHandler& aAiwServiceHandler);
       
   167     
       
   168     /**
       
   169      * Check whether the AIW item is enabled
       
   170      * @return Whether the AIW item is enabled
       
   171      */
       
   172     TBool AiwItemEnabledL();
       
   173 
       
   174     TBool AppendTextParameterL(const TGlxMedia& aItem,
       
   175                               CGlxAiwServiceHandler& aAiwServiceHandler,
       
   176                               const TDesC& aText,
       
   177                               TGenericParamIdValue aGenericParamIdValue);
       
   178                               
       
   179     /*
       
   180     TBool AppendTextParameterL(CGlxAiwServiceHandler& aAiwServiceHandler,
       
   181                               const TDesC& aText,
       
   182                               TGenericParamIdValue aGenericParamIdValue);
       
   183     */
       
   184 
       
   185 private:
       
   186     /// Menu resource containing iCommandId
       
   187     TInt iMenuResource;
       
   188         
       
   189     /// The AppUI, not owned.
       
   190     CAknAppUi* iAppUi;
       
   191     
       
   192     /// Pointer to the AiwServiceHandler. This is the real CGlxAiwServiceHandler, of which there can only be one instance, Hence the need to wrap
       
   193     /// in this singleton class.
       
   194     CGlxAiwServiceHandler* iAiwServiceHandler;
       
   195     TInt iResourceOffset;
       
   196     };
       
   197 
       
   198 #endif // C_GLXCOMMANDHANDLERAIWBASE_H