commondrm/drmrightsmanagerui/inc/DRMRightsMgrAppUi.h
changeset 0 95b198f216e5
child 18 8a03a285ab14
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2003-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:  Declares UI class for application.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef DRMRIGHTSMGRAPPUI_H
       
    21 #define DRMRIGHTSMGRAPPUI_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <aknviewappui.h>
       
    25 #include <aknprogressdialog.h>
       
    26 #include <apparc.h>
       
    27 #include <drmrightsclient.h>
       
    28 
       
    29 #include "drmviewitems.h"
       
    30 
       
    31 #include "drmrightsmanager.hrh"
       
    32 
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CAknWaitDialog;
       
    36 class CDRMRights;
       
    37 class DRMCommon;
       
    38 
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 * Application UI class.
       
    44 * Provides support for the following features:
       
    45 * - EIKON control architecture
       
    46 * - view architecture
       
    47 * - status pane
       
    48 */
       
    49 class CDRMRightsMgrAppUi :  public  CAknViewAppUi,
       
    50                             public  MApaEmbeddedDocObserver,
       
    51                             private MProgressDialogCallback,
       
    52                             public  MCoeForegroundObserver
       
    53     {
       
    54     public:     // Data Types
       
    55         // Status of scanning of the ROs
       
    56         enum TStatusScan
       
    57             {
       
    58             // Scanning started when app launched
       
    59             EDRMStatusOpening = 0,
       
    60 
       
    61             // Scanning started when app launched embedded
       
    62             EDRMStatusOpeningEmbedded,
       
    63 
       
    64             // Scanning finished
       
    65             EDRMStatusFinished
       
    66             };
       
    67 
       
    68     public:    // Constructors and destructor
       
    69         /**
       
    70         * C++ default constructor
       
    71         */
       
    72         CDRMRightsMgrAppUi();
       
    73 
       
    74         /**
       
    75         * Symbian default constructor.
       
    76         */
       
    77         void ConstructL();
       
    78 
       
    79         /**
       
    80         * Destructor.
       
    81         */
       
    82         ~CDRMRightsMgrAppUi();
       
    83 
       
    84 
       
    85     private:    // New functions
       
    86 
       
    87         /**
       
    88         * Processes engine error
       
    89         * @param aCloseImmediately  ETrue if program should be close
       
    90         *                           immediately. EFalse if only app shutter
       
    91         *                           should be started.
       
    92         */
       
    93         void ProcessEngineErrorL( TBool aCloseImmediately );
       
    94 
       
    95         /**
       
    96         * Open Details View only, when DRMUi is launched to show only that
       
    97         * view, but not in embedded mode
       
    98         * @param aParams    The params used to launch DRMUI
       
    99         */
       
   100         void OpenDetailsViewNotEmbeddedL( const TDesC& aParams );
       
   101 
       
   102         /**
       
   103         * Creates the Wait Dialog to be showed during long asynchronous
       
   104         * operations
       
   105         */
       
   106         void CreateWaitDialogLC();
       
   107 
       
   108         /**
       
   109         * Extracts the name of the object to be showed in the list
       
   110         * @param aFullName  The path name of the object
       
   111         * @param aItemName  In output the name of the object to be showed in
       
   112         *                   the list
       
   113         * @param aID        The ID of the object
       
   114         * @param aIsGroup   Tells if the object is a group
       
   115         */
       
   116         void GetItemNameL( const TDesC& aFullName, TDes& aItemName,
       
   117                            const TDesC8& aID, const TBool aIsGroup );
       
   118 
       
   119 
       
   120         /**
       
   121         * Evaluates if the given content file can be shown in keys list, and if it
       
   122         * can be forwarded or not. Returns KErrNone if successful otherwise error code.
       
   123         * @param aFileName    File name with full path
       
   124         * @param aContentURI  Content id
       
   125         * @param aListable    Tells if MO can be shown in keys list
       
   126         * @param aSendable    Tells if MO can be forwarded
       
   127         */
       
   128         TInt GetItemDataL( const TDesC& aFileName,
       
   129                            const TDesC8& aContentURI,
       
   130                            TBool& aListable,
       
   131                            TBool& aSendable );
       
   132 
       
   133         /**
       
   134         * Get a rights manager instance
       
   135         * @return               Rights Manager instance
       
   136         */
       
   137         ContentAccess::CRightsManager* GetRightsManagerL();
       
   138 
       
   139         /**
       
   140         * Checks the status of WM DRM rights
       
   141         * @param aContentURI    ContentURI for object to be opened when
       
   142         *                       application is launched
       
   143         * @param aStatus        Status of the rights
       
   144         * @param aArray         Array for storing the rights
       
   145         */
       
   146         void CheckWmDrmRightsL( const TDesC8& aContentURI, TInt& aStatus,
       
   147             ContentAccess::RStreamablePtrArray<ContentAccess::CRightsInfo>& aArray );
       
   148 
       
   149         /**
       
   150         * Checks the status of OMA DRM rights
       
   151         * @param aContentURI    ContentURI for object to be opened when
       
   152         *                       application is launched
       
   153         * @param aLocalID       LocalID for object to be opened when
       
   154         *                       application is launched
       
   155         * @param aRights        Pointer to instance of CDRMRights for
       
   156         *                       storing the rights
       
   157         * @param aStatus        Status of the rights
       
   158         */
       
   159         void CheckOmaDrmRightsL( const TDesC8& aContentURI,
       
   160                                  const TUint32 aLocalID,
       
   161                                  CDRMRights*& aRights,
       
   162                                  TInt& aStatus );
       
   163 
       
   164         /**
       
   165         * Checks the individual constraint of OMA DRM rights
       
   166         * @param aContentURI            ContentURI for object to be opened when
       
   167         *                               application is launched
       
   168         * @param aIndividualConstraint  Whether rights have an individual
       
   169         *                               constraint or not
       
   170         * @param aUsageAllowed          Whether individually constrained rights
       
   171         *                               can be used for using the content
       
   172         */
       
   173         void CheckIndividualConstraint( const TDesC8& aContentURI,
       
   174                                         TBool& aIndividualConstraint,
       
   175                                         TBool& aUsageAllowed );
       
   176 
       
   177 
       
   178 
       
   179     public: // New functions
       
   180         /**
       
   181         * @param aContentURI    ContentURI for object to be opened when
       
   182         *                       application is launched embedded
       
   183         * @param aLocalID       LocalID for object to be opened when
       
   184         *                       application is launched embedded
       
   185         * @param aEmbedded      Tells if the DRMUi was launched embedded
       
   186         * @param aDrmScheme     Tells the DRM protection scheme of the file
       
   187         */
       
   188         void StartOnlyForDetailsL( const TDesC8& aContentURI,
       
   189                                    const TUint32 aLocalID,
       
   190                                    const TBool aEmbedded,
       
   191                                    const TBool aDrmScheme );
       
   192 
       
   193         /**
       
   194         * Gets the index in array of items of the selected item.
       
   195         * @return The index of the selected item.
       
   196         */
       
   197         inline TInt SelectedIndexInArray();
       
   198 
       
   199         /**
       
   200         * Returns the selected item name.
       
   201         * @param aItemName  In output the selected item name
       
   202         */
       
   203         inline void SelectedItemName( TFileName& aItemName );
       
   204 
       
   205         /**
       
   206         * Returns the selected item path name.
       
   207         * @param aItemFullName  In output the selected item path name
       
   208         */
       
   209         inline void SelectedItemFullName( TFileName& aItemFullName );
       
   210 
       
   211         /**
       
   212         * Tells if the selected item content can be sent
       
   213         * @return   ETrue if the selected item content can be sent
       
   214         */
       
   215         inline TBool SelectedContentCanBeSent();
       
   216 
       
   217         /**
       
   218         * Tells if the selected item has unlimited rights
       
   219         * @return   ETrue if the selected item has unlimited rights
       
   220         */
       
   221         inline TBool UnlimitedRights();
       
   222 
       
   223         /**
       
   224         * Tells if the selected item has individual constraint
       
   225         * @return   ETrue if the selected item has individual constraint
       
   226         */
       
   227         inline TBool IndividualConstraint();
       
   228 
       
   229         /**
       
   230         * Tells if the selected item can be used with current SIM
       
   231         * @return   ETrue if the selected item can be used with current SIM
       
   232         */
       
   233         inline TBool UsageAllowed();
       
   234 
       
   235         /**
       
   236         * Returns the local ID of the selected RO
       
   237         * @return The local ID of the selected RO
       
   238         */
       
   239         inline TUint32 SelectedLocalID();
       
   240 
       
   241         /**
       
   242         * Returns the content URI of the selected RO
       
   243         * @param aContentURI    In output, the content URI of the selected RO
       
   244         */
       
   245         inline void SelectedContentURI( TBuf8<KMaxFileName>& aContentURI );
       
   246 
       
   247         /**
       
   248         * Tells if the selected item is a group
       
   249         * @return   ETrue if the selected item is a group
       
   250         */
       
   251         inline TBool SelectedIsGroup();
       
   252 
       
   253         /**
       
   254         * Sets the name of the selected item
       
   255         * @param aItemName  The name of the selected item
       
   256         */
       
   257         inline void SetSelectedItemName( const TDesC& aItemName );
       
   258 
       
   259         /**
       
   260         * Sets the path name of the selected item
       
   261         * @param aItemFullName  The path name of the selected item
       
   262         */
       
   263         inline void SetSelectedItemFullName( const TDesC& aItemFullName );
       
   264 
       
   265         /**
       
   266         * Sets the attribute that tells if the selected item content can be
       
   267         * forwarded or not
       
   268         * @param aContentCanBeSent  ETrue if the selected item content can be
       
   269         *                           forwarded
       
   270         */
       
   271         inline void SetSelectedContentCanBeSent( const TBool aContentCanBeSent );
       
   272 
       
   273         /**
       
   274         * Sets the individual constraint attribute.
       
   275         * @param aIndividualConstraint ETrue if individual constraint
       
   276         */
       
   277         inline void SetSelectedIndividualConstraint( const TBool aIndividualConstraint );
       
   278 
       
   279         /**
       
   280         * Sets the usage allowed with current SIM attribute.
       
   281         * @param aUsageAllowed ETrue if allowed
       
   282         */
       
   283         inline void SetSelectedUsageAllowed( const TBool aUsageAllowed );
       
   284 
       
   285 
       
   286 
       
   287 
       
   288     private:    // From CEikAppUi
       
   289         /**
       
   290         * From CEikAppUi, handles key events.
       
   291         * @param aKeyEvent Event to handled.
       
   292         * @param aType Type of the key event.
       
   293         * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed).
       
   294         */
       
   295         virtual TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent,
       
   296                                               TEventCode aType);
       
   297 
       
   298         /**
       
   299         * Handles resource change events.
       
   300         * @param aType: The type of resources that have changed
       
   301         */
       
   302         void HandleResourceChangeL( TInt aType );
       
   303 
       
   304 
       
   305     public:    // From CEikAppUi
       
   306         /**
       
   307         * Takes care of command handling.
       
   308         * @param aCommand command to be handled
       
   309         */
       
   310         void HandleCommandL( TInt aCommand );
       
   311 
       
   312         /**
       
   313         * Processes shell commands.
       
   314         * @param aCommand       The shell command sent to the application.
       
   315         * @param aDocumentName  The name of the document
       
   316         * @param aTail          Command line tail.
       
   317         * @return               Always EFalse
       
   318         */
       
   319         TBool ProcessCommandParametersL( TApaCommand aCommand,
       
   320                                          TFileName& aDocumentName,
       
   321                                          const TDesC8& aTail );
       
   322 
       
   323         /**
       
   324         * Processes Application Architecture messages.
       
   325         * @param aUid       The message’s unique identifier.
       
   326         * @param aParams    Message parameters
       
   327         */
       
   328         void ProcessMessageL( TUid aUid, const TDesC8& aParams );
       
   329 
       
   330 
       
   331     public: // From MApaEmbeddedDocObserver
       
   332 
       
   333         /**
       
   334         * Implements the required behaviour when the editing of an embedded
       
   335         * document completes.
       
   336         * @param aMode  Indicates the state of the document
       
   337         */
       
   338         void NotifyExit( TExitMode aMode );
       
   339 
       
   340 
       
   341     public: // From MProgressDialogCallback
       
   342         /**
       
   343         * Called when/if the dialog has been dismissed.
       
   344         * @param aButtonId  Pressed button
       
   345         */
       
   346         void DialogDismissedL( TInt aButtonId );
       
   347 
       
   348     public: // From MCoeForegroundObserver
       
   349         /**
       
   350         * Handles the application coming to the foreground 
       
   351         *
       
   352         */
       
   353         void HandleGainingForeground();
       
   354 
       
   355         /**
       
   356         * Handles the application going into the background
       
   357         *
       
   358         */
       
   359         void HandleLosingForeground();
       
   360 
       
   361     private: //Data
       
   362         // ETrue whan DRMUI is started embedded to show the Details View only.
       
   363         TBool iStartEmbedded;
       
   364 
       
   365         // Data of the selected item.
       
   366         TItemData iSelectedItem;
       
   367 
       
   368         // Status of the scanning.
       
   369         TStatusScan iStatusScan;
       
   370 
       
   371         // Wait dialog. Owned.
       
   372         CAknWaitDialog* iWaitDialog;
       
   373 
       
   374         // Pointer to DRMCommon. Owned.
       
   375         DRMCommon* iDRMCommon;
       
   376 
       
   377         // The DRM Rights Client.
       
   378         RDRMRightsClient iRightsClient;
       
   379 
       
   380         // The DRM protection of the given file.
       
   381         TInt iDrmScheme;
       
   382         
       
   383         // The local ID of the rights
       
   384         TUint32 iLocalID;
       
   385         
       
   386         // Content URI of the file for which the details view has been opened
       
   387         HBufC8* iContentURI;  
       
   388         
       
   389         // The details view has been opened once. This information is used to
       
   390         // update the details view when returning to details view from another
       
   391         // application
       
   392         TBool iForegroundHasBeenActive;
       
   393 
       
   394     };
       
   395 
       
   396 // Include inline functions
       
   397 #include "drmrightsmgrappui.inl"
       
   398 
       
   399 
       
   400 #endif
       
   401 
       
   402 // End of File