photosgallery/viewframework/commandhandlers/commandhandlerdrm/inc/glxcommandhandlerdrm.h
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:   DRM rights handler 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  * @internal reviewed 03/07/2007 by Rowland Cook
       
    23  */
       
    24 
       
    25 #ifndef C_GLXCOMMANDHANDLERDRM_H
       
    26 #define C_GLXCOMMANDHANDLERDRM_H
       
    27 
       
    28 // INCLUDES
       
    29 #include <e32base.h>
       
    30 #include <glxmedialistcommandhandler.h>
       
    31 
       
    32 #include <mglxmedialistobserver.h>
       
    33 #include <mglxvisuallistobserver.h>
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class CGlxDRMUtility;
       
    37 class CGlxDrmIconManager;
       
    38 class CGlxDefaultAttributeContext;
       
    39 class MGlxVisualList;
       
    40 class CGlxMedia;
       
    41 class CGlxUiUtility;
       
    42 class CGlxVisualListManager;
       
    43 // CLASS DECLARATION
       
    44 
       
    45 //class
       
    46 
       
    47 /**
       
    48  *  CGlxDRMCommandHandler class 
       
    49  *  Handler for DRM related commands
       
    50  *  @glxdrmcommandhandler.lib
       
    51  *  @author M Byrne
       
    52  */
       
    53 NONSHARABLE_CLASS( CGlxCommandHandlerDrm ) : public CGlxMediaListCommandHandler,
       
    54                                     public MGlxMediaListObserver,
       
    55                                     public MGlxVisualListObserver                                                   
       
    56     {
       
    57 public : //constructor and desctructor
       
    58     /**
       
    59      * Two-phase constructor
       
    60      * @param aMediaListProvider object that provides the media list
       
    61      * @param aIsContainerList 
       
    62      */
       
    63 IMPORT_C static CGlxCommandHandlerDrm* NewL(
       
    64         MGlxMediaListProvider* aMediaListProvider, TBool aIsContainerList);
       
    65         
       
    66     /** Destructor */
       
    67     IMPORT_C ~CGlxCommandHandlerDrm();
       
    68     
       
    69     /** See @ref CGlxCommandHandler::DoActivateL */
       
    70     void DoActivateL(TInt aViewId);
       
    71     
       
    72     /** See @ref MGlxCommandHandler::Deactivate */   
       
    73     void Deactivate();
       
    74     
       
    75 public: // From MGlxMediaListObserver    
       
    76     /// See @ref MGlxMediaListObserver::HandleItemAddedL
       
    77     virtual void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList);
       
    78     
       
    79     /// See @ref MGlxMediaListObserver::HandleMediaL
       
    80     virtual void HandleMediaL(TInt aListIndex, MGlxMediaList* aList);
       
    81     
       
    82     /// See @ref MGlxMediaListObserver::HandleItemRemovedL
       
    83     virtual void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList);
       
    84     
       
    85     /// See @ref MGlxMediaListObserver::HandleItemModifiedL
       
    86     virtual void HandleItemModifiedL(const RArray<TInt>& aItemIndexes, MGlxMediaList* aList);
       
    87     
       
    88     /// See @ref MGlxMediaListObserver::HandleAttributesAvailableL
       
    89     virtual void HandleAttributesAvailableL(TInt aItemIndex,     
       
    90         const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList);
       
    91             
       
    92     /// See @ref MGlxMediaListObserver::HandleFocusChangedL
       
    93     virtual void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList);
       
    94     
       
    95     /// See @ref MGlxMediaListObserver::HandleItemSelectedL
       
    96     virtual void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList);
       
    97     
       
    98     /// See @ref MGlxMediaListObserver::HandleMessageL
       
    99     virtual void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList);
       
   100     
       
   101 public: // from MGlxVisualListObserver
       
   102     /** @see MGlxVisualListObserver::HandleFocusChangedL */
       
   103     void HandleFocusChangedL( TInt aFocusIndex, TReal32 aItemsPerSecond, MGlxVisualList* aList, NGlxListDefs::TFocusChangeType aType );
       
   104     /** @see MGlxVisualListObserver::HandleSizeChanged */
       
   105     void HandleSizeChanged( const TSize& aSize, MGlxVisualList* aList );
       
   106     /** @see MGlxVisualListObserver::HandleVisualRemoved */
       
   107     void HandleVisualRemoved( const CAlfVisual* aVisual,  MGlxVisualList* aList );
       
   108     /** @see MGlxVisualListObserver::HandleVisualAddedL */
       
   109     void HandleVisualAddedL( CAlfVisual* aVisual, TInt aIndex, MGlxVisualList* aList ); 
       
   110     
       
   111 protected:
       
   112     /** see CGlxMediaListCommandHandler::DoExecuteL */
       
   113     TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList);
       
   114     
       
   115     /** @see CGlxMediaListCommandHandler::DoIsDisabled */
       
   116     TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const;
       
   117          
       
   118 private:
       
   119     /** Second phase constructor */
       
   120     void ConstructL(TBool aIsContainerList);
       
   121 
       
   122     /** Constructor */
       
   123     CGlxCommandHandlerDrm(MGlxMediaListProvider* aMediaListProvider);
       
   124     
       
   125     /**
       
   126       * Determine if DRM rights need to be consuned based on thumbnail
       
   127       * or visual size
       
   128       * @param aItemIndex index of item in media list
       
   129       * @param aImageSize size of image
       
   130       * @param aBitmapSize bitmap size
       
   131       * @return ETrue if rights are to be consumed
       
   132       */
       
   133     TBool ConsumeRightsBasedOnSize(TInt aItemIndex, TSize aImageSize, 
       
   134                                                         TSize aBitmapSize);
       
   135     
       
   136     /**
       
   137       * Consume DRM rights if required
       
   138       */                                                    
       
   139     void ConsumeDRMRightsL();     
       
   140     
       
   141     /**
       
   142       * Get size of thumbnail (assuming largest used if DRM rights 
       
   143       * are valid).
       
   144       * @param aMedia CGlxMedia item for current item
       
   145       * @return TSize of thumbnail
       
   146       */
       
   147     TSize ThumbnailSize(const CGlxMedia* aMedia);                                                  
       
   148      
       
   149 private:
       
   150     /// Resource file offset
       
   151     TInt iResourceOffset;
       
   152     // Does the list contain containers or items
       
   153     TInt iIsContainerList;  
       
   154     
       
   155     /** Poniter to instance of DRM utility (owned) */
       
   156     CGlxDRMUtility* iDrmUtility;    
       
   157     
       
   158     /** DRM icon manager - owned */
       
   159     CGlxDrmIconManager* iDrmIconManager;
       
   160     
       
   161     /** Fetch context to retrieve DRM releated attributes (owned) */
       
   162     CGlxDefaultAttributeContext* iFetchContext;
       
   163     
       
   164     /** Visual list manager (owned) */
       
   165     CGlxVisualListManager* iVisualListManager;
       
   166     
       
   167     /** Visual list used by DRM command handler (owned) */
       
   168     MGlxVisualList* iVisualList;
       
   169     
       
   170     /** URI for media list item (owned) */
       
   171     mutable HBufC*  iUrl;
       
   172     
       
   173     /** flag to indicate whether full-screen view active
       
   174      based on dummy view-state commands */
       
   175     TBool iInFullScreen;
       
   176     
       
   177     /** HUI utility class (owned) */
       
   178     CGlxUiUtility* iUiUtility;
       
   179     
       
   180     /** have we already checked rights for current item */
       
   181     TBool iDrmRightsChecked;
       
   182     };
       
   183     
       
   184 #endif // C_GLXDRMCOMMANDHANDLER_H
       
   185 
       
   186 
       
   187