drm_pub/drm_helper_api/inc/Drmhelper.h
changeset 0 95b198f216e5
child 25 50c53e893c3f
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2003, 2004 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:  Class to show miscellaneous DRM related error notes and 
       
    15 *                details about rights 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __DRMHELPER_H__
       
    22 #define __DRMHELPER_H__
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <ConeResLoader.h>
       
    27 #include <apparc.h>
       
    28 #include <rdrmhelper.h>
       
    29 #include <aknserverapp.h>
       
    30 #include <caf/caf.h>
       
    31 #include <caf/content.h>
       
    32 #include <caf/data.h>
       
    33 #include <eikdialg.h>
       
    34 
       
    35 using namespace ContentAccess;
       
    36 
       
    37 // CONSTANTS
       
    38 const TInt KDRMHelperDefaultCountThreshold = 3;
       
    39 const TInt KDRMHelperDefaultTimeThreshold = 7;
       
    40 const TInt KDRMHelperDefaultPercentageThreshold = 10;
       
    41 const TInt KDRMHelperNoteMaxSize ( 256 );  
       
    42 
       
    43 // MACROS
       
    44 
       
    45 // DATA TYPES
       
    46 enum TDRMHelperPreviewMediaType
       
    47         {
       
    48         EPreviewTypeAudio,
       
    49         EPreviewTypeVideo
       
    50         };
       
    51 // FUNCTION PROTOTYPES
       
    52 
       
    53 // FORWARD DECLARATIONS
       
    54 class DRMCommon;
       
    55 class CDRMRightsConstraints;
       
    56 class CDRMRights;
       
    57 class CStringResourceReader;
       
    58 class TDataType;
       
    59 class CCoeEnv;
       
    60 class CConsumeData;
       
    61 class CDRMPermission;
       
    62 class CDRMConstraint;
       
    63 class CAknGlobalNote;
       
    64 class CAknWaitDialog;
       
    65 class CDRMHelperInfoNoteWrapper;
       
    66 class CSchemeHandler;
       
    67 class CMediatorEventProvider;
       
    68 
       
    69 // CLASS DECLARATION
       
    70 
       
    71 /**
       
    72 *  Helper class for wrapping CDRMRightsConstraints.
       
    73 *
       
    74 *  @lib drmhelper.lib
       
    75 *  @since Series 60 2.1
       
    76 */
       
    77 class CDRMHelperRightsConstraints : public CBase
       
    78     {
       
    79     public:  // Constructors and destructor
       
    80         
       
    81         /**
       
    82         * Two-phased constructor.
       
    83         */
       
    84         static CDRMHelperRightsConstraints* NewL( 
       
    85             CDRMRightsConstraints* aConstraints );
       
    86         static CDRMHelperRightsConstraints* NewLC( 
       
    87             CDRMRightsConstraints* aConstraints );
       
    88         
       
    89         /**
       
    90         * Destructor.
       
    91         */
       
    92         IMPORT_C ~CDRMHelperRightsConstraints();
       
    93 
       
    94     public: // New functions
       
    95 
       
    96         /**
       
    97         * checks if the object contains any restrictions 
       
    98         * or if usage is unconstrained.        
       
    99         * @return ETrue if usage is unconstrained
       
   100         */
       
   101         IMPORT_C TBool FullRights();
       
   102 
       
   103         /**
       
   104         * checks if the object contains only preview rights 
       
   105         * @return ETrue if object contains only preview rights
       
   106         */
       
   107         IMPORT_C TBool IsPreview();
       
   108 
       
   109         /**
       
   110         * Gets number of counts left and number of original counts.
       
   111         * Leaves with KErrNotFound if object doesn't have count based rights.
       
   112         * @param aCounter: (out) counts left
       
   113         * @param aOriginalCounter: (out) number of counts when stored to 
       
   114         *                          rights db
       
   115         * @return -
       
   116         */
       
   117         IMPORT_C void GetCountersL( TUint32& aCounter, 
       
   118             TUint32& aOriginalCounter );
       
   119 
       
   120         /**
       
   121         * Gets start time of time based rights.
       
   122         * Leaves with KErrNotFound if object doesn't have time based rights.
       
   123         * @param aStartTime: (out) start time
       
   124         * @return -
       
   125         */
       
   126         IMPORT_C void GetStartTimeL( TTime& aStartTime );
       
   127 
       
   128         /**
       
   129         * Gets end time of time based rights.
       
   130         * Leaves with KErrNotFound if object doesn't have time based rights.
       
   131         * @param aEndTime: (out) start time
       
   132         * @return -
       
   133         */
       
   134         IMPORT_C void GetEndTimeL( TTime& aEndTime );
       
   135 
       
   136         /**
       
   137         * Gets interval time constraint.
       
   138         * Leaves with KErrNotFound if object doesn't have interval constraint.
       
   139         * @param aInterval: (out) interval
       
   140         * @return -
       
   141         */
       
   142         IMPORT_C void GetIntervalL( TTimeIntervalSeconds& aInterval );
       
   143 
       
   144         /**
       
   145         * Gets start time of activated interval constraint.
       
   146         * Leaves with KErrNotFound if interval has not been started yet.
       
   147         * @param aStartTime: (out) start time of activated interval
       
   148         * @return -
       
   149         */
       
   150 
       
   151         IMPORT_C void GetIntervalStartL( TTime& aStartTime );
       
   152         /**
       
   153         * Gets number of counts left, number of original counts and timer 
       
   154         * value for timed-count constraint.
       
   155         * Leaves with KErrNotFound if object doesn't have timed-count 
       
   156         * constraint.
       
   157         * @param aCounter: (out) counts left
       
   158         * @param aOriginalCounter: Invalid, value returned same as aCounter
       
   159         * @param aTimer: (out) timer value
       
   160         * @return -
       
   161         * @since Series 60 3.0
       
   162         */
       
   163         IMPORT_C void GetTimedCountL( TUint32& aCounter, 
       
   164             TUint32& aOriginalCounter, TTimeIntervalSeconds& aTimer );
       
   165 
       
   166         /**
       
   167         * Gets accumulated time left.
       
   168         * Leaves with KErrNotFound if object doesn't have accumulated time 
       
   169         * constraint.
       
   170         * @param aAccumulatedTime: (out) accumulated time left
       
   171         * @return -
       
   172         * @since Series 60 3.0
       
   173         */
       
   174         IMPORT_C void GetAccumulatedTimeL( TTimeIntervalSeconds& aAccumulatedTime );
       
   175 
       
   176     private:
       
   177 
       
   178         /**
       
   179         * C++ default constructor.
       
   180         */
       
   181         CDRMHelperRightsConstraints( CDRMRightsConstraints* aConstrains );
       
   182 
       
   183         /**
       
   184         * By default Symbian 2nd phase constructor is private.
       
   185         */
       
   186         void ConstructL();
       
   187 
       
   188     private:    // Data
       
   189         // pointer to CDRMRightsConstraints object
       
   190         CDRMRightsConstraints* iConstraints;
       
   191     };
       
   192 
       
   193 
       
   194 /**
       
   195 *  Handles some error situations DRM-aware applications may encounter.
       
   196 *
       
   197 *  @lib drmhelper.lib
       
   198 *  @since Series 60 2.1
       
   199 */
       
   200 class CDRMHelper : public CBase, public MAknServerAppExitObserver
       
   201     {
       
   202     public:     // Data
       
   203     
       
   204     enum TDRMHelperNotificationID
       
   205         {
       
   206         ETActivateTextId = 1,
       
   207         ETCountBasedErrorTextId = 2 ,
       
   208         ETCountUsageReduceId = 3,
       
   209         ETCountUsageReduceMediaId = 4
       
   210         };
       
   211 
       
   212     enum TDRMHelperConsumeAction
       
   213         {
       
   214         EStart,
       
   215         EFinish,
       
   216         EPause, 
       
   217         EContinue
       
   218         };
       
   219 
       
   220     enum TDRMHelperOMALevel
       
   221         {
       
   222         EOMA_None, 
       
   223         EOMA_1_0,
       
   224         EOMA_2_0
       
   225         };
       
   226         
       
   227 	enum TDRMHelperPreviewType 
       
   228 		{
       
   229 		ENoPreview, 
       
   230 		EEmbeddedPreview,
       
   231 		EPreviewRights
       
   232 		};
       
   233 
       
   234     enum TDRMHelperAutomatedType
       
   235         {
       
   236         EAutomatedTypeRingingTone,
       
   237         EAutomatedTypeMessageAlert,
       
   238         EAutomatedTypeEmailAlert,
       
   239         EAutomatedTypeIMAlert,
       
   240         EAutomatedTypeCalendarAlarm,
       
   241         EAutomatedTypeScreenSaver,
       
   242         EAutomatedTypeWallpaper, 
       
   243         EAutomatedTypeTheme,
       
   244         EAutomatedTypeClockAlarm, 
       
   245         EAutomatedTypeOther = KMaxTUint8
       
   246         };
       
   247 
       
   248     enum TDRMHelperDRMMethods
       
   249         {
       
   250         EForwardLock = 0x0001, 
       
   251         ECombinedDelivery = 0x0002, 
       
   252         ESeparateDelivery = 0x0004, 
       
   253         ESuperDistribution = 0x0008
       
   254         };
       
   255 
       
   256     public:  // Constructors and destructor
       
   257         
       
   258         /**
       
   259         * Two-phased constructor.
       
   260         */
       
   261         IMPORT_C static CDRMHelper* NewL( CCoeEnv& aCoeEnv );
       
   262         IMPORT_C static CDRMHelper* NewLC( CCoeEnv& aCoeEnv );
       
   263 
       
   264         /**
       
   265         * Two-phased constructor.
       
   266         * @since Series 60 2.6
       
   267         */
       
   268         IMPORT_C static CDRMHelper* NewL();
       
   269         IMPORT_C static CDRMHelper* NewLC();
       
   270         
       
   271         /**
       
   272         * Two-phased constructor.
       
   273         * @since Series 60 3.0
       
   274         */
       
   275         IMPORT_C static CDRMHelper* NewL( CCoeEnv& aCoeEnv, RFs& aFs );
       
   276         IMPORT_C static CDRMHelper* NewLC( CCoeEnv& aCoeEnv, RFs& aFs );
       
   277 
       
   278         /**
       
   279         * Two-phased constructor.
       
   280         * @since Series 60 3.0
       
   281         */
       
   282         IMPORT_C static CDRMHelper* NewL( RFs& aFs );
       
   283         IMPORT_C static CDRMHelper* NewLC( RFs& aFs );
       
   284         
       
   285         /**
       
   286         * Destructor.
       
   287         */
       
   288         IMPORT_C ~CDRMHelper();
       
   289 
       
   290        
       
   291     public: 
       
   292 
       
   293         /**
       
   294         * Displays appropriate error note depending on error code.
       
   295         * @param aError: error code returned by DRM engine
       
   296         * @param aURI: URI of the file
       
   297         * @return 
       
   298         * - Button code, if user selected "buy rights" or "launch rights 
       
   299         *   manager" in query.
       
   300         * - 0 if user selected "No", "Back" or "Cancel" (or whatever which 
       
   301         *   just dismiss the query)
       
   302         * - 0 if just a simple error note is displayed
       
   303         */
       
   304         IMPORT_C TInt HandleErrorL( TInt aError, 
       
   305             const TDesC8& aURI );
       
   306 
       
   307 
       
   308         /**
       
   309         * Displays:
       
   310         * Handles error situations 'rights expired', 'no rights' and
       
   311         * 'rights database corrupted'.
       
   312         * @param aError: error code returned by DRM engine
       
   313         * @param aFileName: full path to file
       
   314         * @return 
       
   315         * - Button code, if user selected "buy rights" or "launch rights 
       
   316         *   manager" in query.
       
   317         * - 0 if user selected "No", "Back" or "Cancel" (or whatever which 
       
   318         *   just dismiss the query)
       
   319         * - 0 if just a simple error note is displayed
       
   320         */
       
   321         IMPORT_C TInt HandleErrorL( TInt aError, 
       
   322             const TDesC& aFileName );
       
   323 
       
   324 
       
   325         /**
       
   326         * Displays:
       
   327         * Handles error situations 'rights expired', 'no rights' and
       
   328         * 'rights database corrupted'.
       
   329         * @param aError: error code returned by DRM engine
       
   330         * @param aFileHandle: file handle to the file
       
   331         * @return 
       
   332         * - Button code, if user selected "buy rights" or "launch rights 
       
   333         *   manager" in query.
       
   334         * - 0 if user selected "No", "Back" or "Cancel" (or anything that 
       
   335         *   just dismisses the query)
       
   336         * - 0 if just a simple error note is displayed
       
   337         * @since  3.0
       
   338         */
       
   339         IMPORT_C TInt HandleErrorL( TInt aError, 
       
   340             RFile& aFileHandle );
       
   341 
       
   342        /**
       
   343         * Handles DRM-specific error situations. Should be called instead of 
       
   344         * HandleErrorL if user should be asked to play embedded preview or get 
       
   345         * preview/silent rights if there is no valid rights and either embedded preview or
       
   346         * preview rights are available.
       
   347         * @param aError: error code to be handled.
       
   348         * @param aFile: handle of file for which error was received.
       
   349         * @param aEmbeddedPreviewUri: contain URI of embedded preview part 
       
   350         * upon return if caller should play the embedded preview. If embedded
       
   351         * preview should not be played this is NULL. Must be freed by caller.
       
   352         * @return KErrNone if the content is now usable (e.g. silent rights or preview rights were gotten). If
       
   353         *                  the return code is KErrNone and the aEmbeddedPreviewUri parameter is not NULL,
       
   354         *                  the player should use embedded preview
       
   355         *         KErrCancel if the user cancelled any of the actions within the function
       
   356         *         KErrCANoRights and KErrCANoPermission if after the function call, still no rights exist
       
   357         *         KErrCompletion if the user did launch the browser, but it is not clear whether the content
       
   358         *                  was activated
       
   359         * @since S60 3.1
       
   360         */
       
   361         IMPORT_C TInt HandleErrorOrPreviewL( 
       
   362             TInt aError, 
       
   363             RFile& aFile, 
       
   364             HBufC8*& aEmbeddedPreviewUri );
       
   365 
       
   366        /**
       
   367         * Handles DRM specific error situations. Should be called instead of 
       
   368         * HandleErrorL if user should be asked to play embedded preview or get 
       
   369         * preview/silent rights if there is no valid rights and either embedded preview or
       
   370         * preview rights are available.
       
   371         * @param aError: error code to be handled.
       
   372         * @param aFileName: name of file for which error was received.
       
   373         * @param aEmbeddedPreviewUri: contain URI of embedded preview part 
       
   374         * upon return if caller should play the embedded preview. If embedded
       
   375         * preview should not be played this is NULL. Must be freed by caller.
       
   376         * @return KErrNone if the content is now usable (e.g. silent rights or preview rights were gotten). If
       
   377         *                  the return code is KErrNone and the aEmbeddedPreviewUri parameter is not NULL,
       
   378         *                  the player should use embedded preview
       
   379         *         KErrCancel if the user cancelled any of the actions within the function
       
   380         *         KErrCANoRights and KErrCANoPermission if after the function call, still no rights exist
       
   381         *         KErrCompletion if the user did launch the browser, but it is not clear whether the content
       
   382         *                  was activated
       
   383         * @since S60 3.1
       
   384         */
       
   385         IMPORT_C TInt HandleErrorOrPreviewL( 
       
   386             TInt aError, 
       
   387             const TDesC& aFileName, 
       
   388             HBufC8*& aEmbeddedPreviewUri );
       
   389 
       
   390         /**
       
   391         * Check rights for the content. If there is less than given amount 
       
   392         * of usage time/count left, appropriate note is displayed
       
   393         * depending on situation.
       
   394         * @param  aURI: URI of the file
       
   395         * @return Button code
       
   396         */
       
   397         // causes conflict with other CheckRightsAmount method, removed for now...
       
   398 //        IMPORT_C TInt CheckRightsAmountL( const TDesC8& aURI );
       
   399 
       
   400 
       
   401         /**
       
   402         * Check rights for the file. If there is less than given amount 
       
   403         * of usage time/count/percentage left, appropriate note is displayed
       
   404         * depending on situation.
       
   405         * @param  aFileName: Full path to file
       
   406         * @return Button code
       
   407         */
       
   408         // causes conflict with other CheckRightsAmount method, removed for now...
       
   409 //        IMPORT_C TInt CheckRightsAmountL( const TDesC& aFileName );
       
   410                 
       
   411 
       
   412         /**
       
   413         * Check rights for the file. If there is less than given amount 
       
   414         * of usage time/count/percentage left, appropriate note is displayed
       
   415         * depending on situation.
       
   416         * @param  aFileHandle: file handle to the file
       
   417         * @return Button code
       
   418         * @since  3.0
       
   419         */
       
   420         // causes conflict with other CheckRightsAmount method, removed for now...
       
   421 //        IMPORT_C TInt CheckRightsAmountL( RFile& aFileHandle );
       
   422 
       
   423 
       
   424         /**
       
   425         * Check rights for the file. If there is less than given amount 
       
   426         * of usage time/count left, one of the following note is displayed
       
   427         * depending on situation:
       
   428         * 'Usage rights about to expire. View details?'
       
   429         * 'Usage rights about to expire. %N days left. View details?'
       
   430         * 'Usage rights about to expire. 1 day left. View details?'
       
   431         * 'Usage rights about to expire. %N counts left. View details?'
       
   432         * 'Usage rights about to expire. 1 count left. View details?'
       
   433         * It also checks that rights are valid and displays appropriate note,
       
   434         * if they are not.
       
   435         * @param  aFileName: Full path to file
       
   436         * @param  aCount: Threshold value for count limit
       
   437         * @param  aDays: Threshold value for time limit in days
       
   438         * @return Button code
       
   439         */
       
   440         IMPORT_C TInt CheckRightsAmountL( const TDesC& aFileName, 
       
   441             TInt aCount = KDRMHelperDefaultCountThreshold, 
       
   442             TInt aDays = KDRMHelperDefaultTimeThreshold );
       
   443 
       
   444 
       
   445         /**
       
   446         * Check rights for the file. If there is less than given amount 
       
   447         * of usage time/count left, one of the following note is displayed
       
   448         * depending on situation:
       
   449         * 'Usage rights about to expire. View details?'
       
   450         * 'Usage rights about to expire. %N days left. View details?'
       
   451         * 'Usage rights about to expire. 1 day left. View details?'
       
   452         * 'Usage rights about to expire. %N counts left. View details?'
       
   453         * 'Usage rights about to expire. 1 count left. View details?'
       
   454         * It also checks that rights are valid and displays appropriate note,
       
   455         * if they are not.
       
   456         * @param  aFileHandle: file handle to the file
       
   457         * @param  aCount: Threshold value for count limit
       
   458         * @param  aDays: Threshold value for time limit in days
       
   459         * @return Button code
       
   460         * @since  3.0
       
   461         */
       
   462         IMPORT_C TInt CheckRightsAmountL( RFile& aFileHandle, 
       
   463             TInt aCount = KDRMHelperDefaultCountThreshold, 
       
   464             TInt aDays = KDRMHelperDefaultTimeThreshold );
       
   465 
       
   466 
       
   467         /**
       
   468         * Check rights for the file. If there is less than given amount 
       
   469         * of usage time/count left, one of the following note is displayed
       
   470         * depending on situation:
       
   471         * 'Usage rights about to expire. View details?'
       
   472         * 'Usage rights about to expire. %N days left. View details?'
       
   473         * 'Usage rights about to expire. 1 day left. View details?'
       
   474         * 'Usage rights about to expire. %N counts left. View details?'
       
   475         * 'Usage rights about to expire. 1 count left. View details?'
       
   476         * It also checks that rights are valid and displays appropriate note,
       
   477         * if they are not.
       
   478         * @param  aUri: Content URI
       
   479         * @param  aCount: Threshold value for count limit
       
   480         * @param  aDays: Threshold value for time limit in days
       
   481         * @return Button code
       
   482         */
       
   483         IMPORT_C TInt CheckRightsAmountL( const TDesC8& aUri, 
       
   484             TInt aCount = KDRMHelperDefaultCountThreshold, 
       
   485             TInt aDays = KDRMHelperDefaultTimeThreshold );
       
   486 
       
   487 
       
   488         /**
       
   489         * Check rights for the file. If there is less than aThreshold percent 
       
   490         * of usage time/count left, one of the following note is displayed
       
   491         * depending on situation:
       
   492         * 'Usage rights about to expire. View details?'
       
   493         * 'Usage rights about to expire. %N days left. View details?'
       
   494         * 'Usage rights about to expire. 1 day left. View details?'
       
   495         * 'Usage rights about to expire. %N counts left. View details?'
       
   496         * 'Usage rights about to expire. 1 count left. View details?'
       
   497         * It also checks that rights are valid and displays appropriate note,
       
   498         * if they are not.
       
   499         * @param  aFileName: Full path to file
       
   500         * @param  aThreshold: Threshold value in percents for displaying the note
       
   501         * @return Button code
       
   502         */
       
   503         IMPORT_C TInt CheckRightsPercentL( const TDesC& aFileName, 
       
   504             TInt aThreshold = KDRMHelperDefaultPercentageThreshold );
       
   505 
       
   506 
       
   507         /**
       
   508         * Check rights for the file. If there is less than aThreshold percent 
       
   509         * of usage time/count left, one of the following note is displayed
       
   510         * depending on situation:
       
   511         * 'Usage rights about to expire. View details?'
       
   512         * 'Usage rights about to expire. %N days left. View details?'
       
   513         * 'Usage rights about to expire. 1 day left. View details?'
       
   514         * 'Usage rights about to expire. %N counts left. View details?'
       
   515         * 'Usage rights about to expire. 1 count left. View details?'
       
   516         * It also checks that rights are valid and displays appropriate note,
       
   517         * if they are not.
       
   518         * @param  aFileHandle: file handle to the file
       
   519         * @param  aThreshold: Threshold value in percents for displaying the note
       
   520         * @return Button code
       
   521         * @since  3.0
       
   522         */
       
   523         IMPORT_C TInt CheckRightsPercentL( RFile& aFileHandle, 
       
   524             TInt aThreshold = KDRMHelperDefaultPercentageThreshold );
       
   525 
       
   526 
       
   527         /**
       
   528         * Launches DRM Rights Manager UI embedded with details view related 
       
   529         * to given content.
       
   530         * @param aURI: URI of the file
       
   531         * @return -
       
   532         */
       
   533         IMPORT_C void LaunchDetailsViewEmbeddedL( 
       
   534             const TDesC8& aURI );
       
   535 
       
   536 		
       
   537         /**
       
   538         * Launches DRM Rights Manager UI embedded with details view related 
       
   539         * to given file.
       
   540         * @param aFileName: Full path to file
       
   541         * @return -
       
   542         */
       
   543         IMPORT_C void LaunchDetailsViewEmbeddedL( 
       
   544             const TDesC& aFileName );
       
   545 
       
   546 
       
   547         /**
       
   548         * Launches DRM Rights Manager UI embedded with details view related 
       
   549         * to given file.    
       
   550         * @param  aFileHandle: file handle to the file
       
   551         * @return -
       
   552         * @since  3.0
       
   553         */
       
   554         IMPORT_C void LaunchDetailsViewEmbeddedL( 
       
   555             RFile& aFileHandle );
       
   556 
       
   557 
       
   558         /**
       
   559         * Launches DRM Rights Manager UI embedded with details view related 
       
   560         * to given content.
       
   561         * @param aContentURI: URI of the content
       
   562         * @return -
       
   563         */
       
   564         IMPORT_C void LaunchDetailsViewEmbeddedL( 
       
   565             const HBufC8* aContentURI );
       
   566 
       
   567 
       
   568         /**
       
   569         * Gets details of rights object associated of given file.
       
   570         *
       
   571         * @param[in]  aFileName Full path to file
       
   572         * @param[in]  aIntent ContentAccess::EPlay, ContentAccess::EView,
       
   573         * ContentAccess::EPrint or ContentAccess::EExecute 
       
   574         * @param[out] aExpired ETrue if rights are not valid. If this is ETrue
       
   575         * and some constraints are returned, rights will become valid in future
       
   576         * @param[out] aSendingAllowed ETrue if content can be sent
       
   577         * @param[out] aPlay play constraints, must be deleted by caller
       
   578         * @param[out] aDisplay display constraints, must be deleted by caller
       
   579         * @param[out] aExecute execute constraints, must be deleted by caller
       
   580         * @param[out] aPrint print constraints, must be deleted by caller
       
   581         *
       
   582         * @leave KErrArgument file is not DRM-protected.
       
   583         * @leave KErrCANoRights no rights
       
   584         * @see caferr.h
       
   585         * @see caftypes.h
       
   586         */
       
   587         IMPORT_C void GetRightsDetailsL( const TDesC& aFileName, 
       
   588             TUint32 aIntent, TBool& aExpired, TBool& aSendingAllowed, 
       
   589             CDRMHelperRightsConstraints*& aPlay, 
       
   590             CDRMHelperRightsConstraints*& aDisplay, 
       
   591             CDRMHelperRightsConstraints*& aExecute, 
       
   592             CDRMHelperRightsConstraints*& aPrint );
       
   593 
       
   594 
       
   595         /**
       
   596         * Gets details of rights object associated of given file.
       
   597         * 
       
   598         * @param[in]  aFileHandle file handle to the file
       
   599         * @param[in]  aIntent ContentAccess::EPlay, ContentAccess::EView,
       
   600         * ContentAccess::EPrint or ContentAccess::EExecute 
       
   601         * @param[out] aExpired ETrue if rights are not valid. If this is ETrue
       
   602         * and some constraints are returned, rights will become valid in future
       
   603         * @param[out] aSendingAllowed ETrue if content can be sent
       
   604         * @param[out] aPlay play constraints, must be deleted by caller
       
   605         * @param[out] aDisplay display constraints, must be deleted by caller
       
   606         * @param[out] aExecute execute constraints, must be deleted by caller
       
   607         * @param[out] aPrint print constraints, must be deleted by caller
       
   608         *
       
   609         * @leave KErrArgument file is not DRM-protected.
       
   610         * @leave KErrCANoRights no rights
       
   611         * @see caferr.h
       
   612         * @see caftypes.h
       
   613         *
       
   614         * @since  3.0
       
   615         */
       
   616         IMPORT_C void GetRightsDetailsL( RFile& aFileHandle,  
       
   617             TUint32 aIntent, TBool& aExpired, TBool& aSendingAllowed, 
       
   618             CDRMHelperRightsConstraints*& aPlay, 
       
   619             CDRMHelperRightsConstraints*& aDisplay, 
       
   620             CDRMHelperRightsConstraints*& aExecute, 
       
   621             CDRMHelperRightsConstraints*& aPrint );
       
   622 
       
   623 
       
   624         /**
       
   625         * Gets details of rights object associated of given file.
       
   626         *
       
   627         * @param[in]  aFileName Full path to file
       
   628         * @param[in]  aIntent ContentAccess::EPlay, ContentAccess::EView,
       
   629         * ContentAccess::EPrint or ContentAccess::EExecute 
       
   630         * @param[out] aExpired ETrue if rights are not valid. If this is ETrue
       
   631         * and some constraints are returned, rights will become valid in future
       
   632         * @param[out] aSendingAllowed ETrue if content can be sent
       
   633         * @param[out] aPlay play constraints, must be deleted by caller
       
   634         * @param[out] aDisplay display constraints, must be deleted by caller
       
   635         * @param[out] aExecute execute constraints, must be deleted by caller
       
   636         * @param[out] aPrint print constraints, must be deleted by caller
       
   637         *
       
   638         * @leave KErrArgument file is not DRM-protected.
       
   639         * @leave KErrCANoRights no rights
       
   640         * @see caferr.h
       
   641         * @see caftypes.h
       
   642         */
       
   643         IMPORT_C void GetRightsDetailsL( const TDesC& aFileName, 
       
   644             TUint32 aIntent, TBool& aExpired, TBool& aSendingAllowed, 
       
   645             CDRMRightsConstraints*& aPlay, 
       
   646             CDRMRightsConstraints*& aDisplay, 
       
   647             CDRMRightsConstraints*& aExecute, 
       
   648             CDRMRightsConstraints*& aPrint ); 
       
   649 
       
   650 
       
   651         /**
       
   652         * Gets details of rights object associated of given file.
       
   653         * 
       
   654         * @param[in]  aFileHandle file handle to the file
       
   655         * @param[in]  aIntent ContentAccess::EPlay, ContentAccess::EView,
       
   656         * ContentAccess::EPrint or ContentAccess::EExecute 
       
   657         * @param[out] aExpired ETrue if rights are not valid. If this is ETrue
       
   658         * and some constraints are returned, rights will become valid in future
       
   659         * @param[out] aSendingAllowed ETrue if content can be sent
       
   660         * @param[out] aPlay play constraints, must be deleted by caller
       
   661         * @param[out] aDisplay display constraints, must be deleted by caller
       
   662         * @param[out] aExecute execute constraints, must be deleted by caller
       
   663         * @param[out] aPrint print constraints, must be deleted by caller
       
   664         *
       
   665         * @leave KErrArgument file is not DRM-protected.
       
   666         * @leave KErrCANoRights no rights
       
   667         * @see caferr.h
       
   668         * @see caftypes.h
       
   669         *
       
   670         * @since  3.0
       
   671         */
       
   672         IMPORT_C void GetRightsDetailsL( RFile& aFileHandle,  
       
   673             TUint32 aIntent, TBool& aExpired, TBool& aSendingAllowed, 
       
   674             CDRMRightsConstraints*& aPlay, 
       
   675             CDRMRightsConstraints*& aDisplay, 
       
   676             CDRMRightsConstraints*& aExecute, 
       
   677             CDRMRightsConstraints*& aPrint ); 
       
   678 
       
   679 
       
   680         /**
       
   681         * Registers given content to be used as an automated content. This
       
   682         * function is used when registering application listens expiry 
       
   683         * notifications itself
       
   684         * @param  aURI: content URI
       
   685         * @return System wide error code (KErrCancel if user pressed no to 
       
   686         * query).
       
   687         * @since Series 60 2.6
       
   688         */
       
   689         IMPORT_C TInt SetAutomated( const TDesC8& aURI );
       
   690 
       
   691 
       
   692         /**
       
   693         * Registers given content to be used as an automated content. This
       
   694         * function is used when registering application listens expiry 
       
   695         * notifications itself.
       
   696         * @param  aFileName: Full path to file
       
   697         * @return System wide error code (KErrCancel if user pressed no to 
       
   698         * query).
       
   699         * @since Series 60 2.6
       
   700         */
       
   701         IMPORT_C TInt SetAutomated( const TDesC& aFilename );
       
   702 
       
   703 
       
   704         /**
       
   705         * Registers given content to be used as an automated content. This
       
   706         * function is used when registering application listens expiry 
       
   707         * @param  aFileHandle: file handle to the file
       
   708         * @return System wide error code (KErrCancel if user pressed no to 
       
   709         * query).
       
   710         * @since  3.0
       
   711         */
       
   712         IMPORT_C TInt SetAutomated( RFile& aFileHandle );
       
   713 
       
   714 
       
   715         /**
       
   716         * Displays the confirmation query about setting given content as an
       
   717         * automated content. Note that this function does not actually
       
   718         * register content, just displays the note
       
   719         * @param  aURI: content URI
       
   720         * @return System wide error code (KErrCancel if user pressed no to 
       
   721         * query).
       
   722         * @since Series 60 2.6
       
   723         */
       
   724         IMPORT_C TInt ShowAutomatedNote( const TDesC8& aURI );
       
   725 
       
   726 
       
   727         /**
       
   728         * Displays the confirmation query about setting given content as an
       
   729         * automated content. Note that this function does not actually
       
   730         * register content, just displays the note
       
   731         * @param  aFileName: Full path to file
       
   732         * @return System wide error code (KErrCancel if user pressed no to 
       
   733         * query).
       
   734         * @since Series 60 2.6
       
   735         */
       
   736         IMPORT_C TInt ShowAutomatedNote( const TDesC& aFilename );
       
   737 
       
   738 
       
   739         /**
       
   740         * Displays the confirmation query about setting given content as an
       
   741         * automated content. Note that this function does not actually
       
   742         * register content, just displays the note
       
   743         * @param  aFileHandle: file handle to the file
       
   744         * @return System wide error code (KErrCancel if user pressed no to 
       
   745         * query).
       
   746         * @since  3.0
       
   747         */
       
   748         IMPORT_C TInt ShowAutomatedNote( RFile& aFileHandle );
       
   749 
       
   750 
       
   751         /**
       
   752         * Registers given content to be used as an automated content. This
       
   753         * function is used when phone application listens to expiry notifications.
       
   754         * @param  aURI: content URI
       
   755         * @return System wide error code (KErrCancel if user pressed no to 
       
   756         * query).
       
   757         * @since Series 60 2.6
       
   758         */
       
   759         IMPORT_C TInt SetAutomatedPassive( const TDesC8& aURI );
       
   760 
       
   761 
       
   762         /**
       
   763         * Registers given content to be used as an automated content. This
       
   764         * function is used when phone application listens to expiry notifications.
       
   765         * @param  aFileName: Full path to file
       
   766         * @return System wide error code (KErrCancel if user pressed no to 
       
   767         * query).
       
   768         * @since Series 60 2.6
       
   769         */
       
   770         IMPORT_C TInt SetAutomatedPassive( const TDesC& aFilename );
       
   771 
       
   772 
       
   773         /**
       
   774         * Registers given content to be used as an automated content. This
       
   775         * function is used when phone application listens to expiry notifications.
       
   776         * @param  aFileHandle: file handle to the file
       
   777         * @return System wide error code (KErrCancel if user pressed no to 
       
   778         * query).
       
   779         * @since  3.0
       
   780         */
       
   781         IMPORT_C TInt SetAutomatedPassive( RFile& aFileHandle );
       
   782 
       
   783 
       
   784         /**
       
   785         * Registers given content to be used as an automated content without
       
   786         * confirmation query.
       
   787         * @param aURI: content URI
       
   788         * @param aActive: ETrue if registering application itself listens
       
   789         *                 expiry notifications
       
   790         * @return System wide error code (KErrCancel if user pressed no to 
       
   791         * query).
       
   792         * @since Series 60 2.6
       
   793         */
       
   794         IMPORT_C TInt SetAutomatedSilent( const TDesC8& aURI, TBool aActive );
       
   795 
       
   796 
       
   797         /**
       
   798         * Registers given content to be used as an automated content without
       
   799         * confirmation query.
       
   800         * @param  aFileName: Full path to file
       
   801         * @param  aActive: ETrue if registering application itself listens
       
   802         *                  expiry notifications
       
   803         * @return System wide error code (KErrCancel if user pressed no to 
       
   804         * query).
       
   805         * @since Series 60 2.6
       
   806         */
       
   807         IMPORT_C TInt SetAutomatedSilent( const TDesC& aFilename, 
       
   808             TBool aActive );
       
   809 
       
   810 
       
   811         /**
       
   812         * Registers given content to be used as an automated content without
       
   813         * confirmation query.
       
   814         * @param  aFileHandle: file handle to the file
       
   815         * @param  aActive: ETrue if registering application itself listens
       
   816         *                  expiry notifications
       
   817         * @return System wide error code (KErrCancel if user pressed no to 
       
   818         * query).
       
   819         * @since  3.0
       
   820         */
       
   821         IMPORT_C TInt SetAutomatedSilent( RFile& aFileHandle,  
       
   822             TBool aActive );
       
   823 
       
   824 
       
   825         /**
       
   826         * Unregisters given content to be used as an automated content.
       
   827         * @param aURI: content URI
       
   828         * @return System wide error code.
       
   829         * @since Series 60 2.6
       
   830         */
       
   831         IMPORT_C TInt RemoveAutomated( const TDesC8& aURI );
       
   832 
       
   833 
       
   834         /**
       
   835         * Unregisters given content to be used as an automated content.
       
   836         * @param  aFileName: Full path to file
       
   837         * @return System wide error code.
       
   838         * @since Series 60 2.6
       
   839         */
       
   840         IMPORT_C TInt RemoveAutomated( const TDesC& aFilename );
       
   841 
       
   842 
       
   843         /**
       
   844         * Unregisters given content to be used as an automated content.
       
   845         * @param  aFileHandle: file handle to the file
       
   846         * @return System wide error code.
       
   847         * @since  3.0
       
   848         */
       
   849         IMPORT_C TInt RemoveAutomated( RFile& aFileHandle );
       
   850 
       
   851 
       
   852         /**
       
   853         * Unregisters given content to be used as an automated content.
       
   854         * This function must be used when content was registered using 
       
   855         * SetAutomatedPassive.
       
   856         * @param  aURI: content URI
       
   857         * @return System wide error code.
       
   858         * @since Series 60 2.6
       
   859         */
       
   860         IMPORT_C TInt RemoveAutomatedPassive( const TDesC8& aURI );
       
   861 
       
   862 
       
   863         /**
       
   864         * Unregisters given content to be used as an automated content.
       
   865         * This function must be used when content was registered using 
       
   866         * SetAutomatedPassive.
       
   867         * @param  aFileName: Full path to file
       
   868         * @return System wide error code.
       
   869         * @since Series 60 2.6
       
   870         */
       
   871         IMPORT_C TInt RemoveAutomatedPassive( const TDesC& aFilename );
       
   872 
       
   873 
       
   874         /**
       
   875         * Unregisters given content to be used as an automated content.
       
   876         * This function must be used when content was registered using 
       
   877         * SetAutomatedPassive.
       
   878         * @param  aFileHandle: file handle to the file
       
   879         * @return System wide error code.
       
   880         * @since  3.0
       
   881         */
       
   882         IMPORT_C TInt RemoveAutomatedPassive( RFile& aFileHandle );
       
   883 
       
   884 
       
   885         /**
       
   886         * Checks if given content can be set as an automated content.
       
   887         * @param  aURI: content URI
       
   888         * @param  aValue: ETrue if content can be set as automated.
       
   889         * @return System wide or DRM specific error code.
       
   890         * @since Series 60 2.6
       
   891         */
       
   892         IMPORT_C TInt CanSetAutomated( const TDesC8& aURI, 
       
   893             TBool& aValue );
       
   894 
       
   895 
       
   896         /**
       
   897         * Checks if given content can be set as an automated content.
       
   898         * @param  aFileName: Full path to file
       
   899         * @param  aValue: ETrue if content can be set as automated.
       
   900         * @return System wide or DRM specific error code.
       
   901         * @since Series 60 2.6
       
   902         */
       
   903         IMPORT_C TInt CanSetAutomated( const TDesC& aFilename, 
       
   904             TBool& aValue );
       
   905 
       
   906 
       
   907         /**
       
   908         * Checks if given content can be set as an automated content.
       
   909         * @param  aFileHandle: file handle to the file
       
   910         * @param  aValue: ETrue if content can be set as automated.
       
   911         * @return System wide or DRM specific error code.
       
   912         * @since  3.0
       
   913         */
       
   914         IMPORT_C TInt CanSetAutomated( RFile& aFileHandle, 
       
   915             TBool& aValue );
       
   916 
       
   917 
       
   918         /**
       
   919         * Informs DRMHelper that idle-screen has been activated.
       
   920         * @return -
       
   921         * @since Series 60 2.6
       
   922         */
       
   923         IMPORT_C void IndicateIdle();
       
   924 
       
   925         /**
       
   926         * Handle the general UI based error notes 
       
   927         * @since  3.0
       
   928         * @param aTextId The code for DRM general notification note.
       
   929         * @param aURI The DRM files URI, that caused the DRM error.
       
   930         * @return KErrnone if everything went ok, else wide scale of Symbian errors
       
   931         */
       
   932         IMPORT_C TInt ShowDRMUINotification2L( TDRMHelperNotificationID aTextId,
       
   933             const TDesC8& aURI );
       
   934 
       
   935 
       
   936         /**
       
   937         * Handle the general UI based error notes 
       
   938         * @since  3.0
       
   939         * @param aTextId The code for DRM general notification note.
       
   940         * @param aFileName The DRM file's name and path, that caused the DRM error.
       
   941         * @return KErrnone if everything went ok, else wide scale of Symbian errors
       
   942         */
       
   943         IMPORT_C TInt ShowDRMUINotification2L( TDRMHelperNotificationID aTextId,
       
   944             const TDesC& aFileName );
       
   945 
       
   946 
       
   947         /**
       
   948         * Set count limit for CheckRightsAmountL
       
   949         * @param aCounts: new count limit for displaying the note.
       
   950         * @return -
       
   951         */
       
   952         IMPORT_C void SetCountLimitL( TUint aCounts );
       
   953 
       
   954         
       
   955         /**
       
   956         * Set time limit in days for CheckRightsAmountL
       
   957         * @param aDays: new time limit for displaying the note.
       
   958         * @return -
       
   959         */
       
   960         IMPORT_C void SetTimeLimitL( TUint aDays );
       
   961 
       
   962 
       
   963         /**
       
   964         * Set percentage limit for CheckRightsAmountL. Applies to both counts and time.
       
   965         * @param aPercentage: new limit for displaying the note.
       
   966         * @return -
       
   967         */
       
   968         IMPORT_C void SetPercentageLimitL( TUint aPercentage );
       
   969 
       
   970 
       
   971         /**
       
   972         * GetContentURIList
       
   973         *
       
   974         * Returns a list of all content URIs that have rights in the rights 
       
   975         * database.
       
   976         *
       
   977         * @since  2.5
       
   978         * @param  aURIList: Out parameter for the URI list.
       
   979         * @return Ok if the URI list could be retreived.
       
   980         */
       
   981         IMPORT_C TInt GetContentURIList(
       
   982             RPointerArray<HBufC8>*& aURIList);
       
   983 
       
   984     
       
   985         /**
       
   986         * DataTypesCount
       
   987         *
       
   988         * Returns the number of previously registered datatypes which are
       
   989         * supported by the DRM system and associated applications.
       
   990         *
       
   991         * @since  2.0
       
   992         * @param  aCount: Out parameter for the datatype count
       
   993         * @return EOk if the number of datatypes has been returned correctly
       
   994         */
       
   995         IMPORT_C TInt DataTypesCount(
       
   996             TInt& aCount);
       
   997 
       
   998     
       
   999         /**
       
  1000         * SupportedDataType
       
  1001         *
       
  1002         * Returns a specific datatype which has been registered before by giving an index
       
  1003         *
       
  1004         * @since  2.0
       
  1005         * @param  aIndex: Number of the datatype to return
       
  1006         * @param  aDataType: Out parameter for the datatype
       
  1007         * @return EOk if the datatype was returned correctly
       
  1008         */
       
  1009         IMPORT_C TInt SupportedDataType(
       
  1010             const TInt aIndex, TDataType& aDataType);
       
  1011 
       
  1012     
       
  1013         /**
       
  1014         * RegisterDataType
       
  1015         *
       
  1016         * Registers a datatype as a supported datatype.
       
  1017         *
       
  1018         * @since  2.0
       
  1019         * @param  aDataType: Datatype to register
       
  1020         * @return EOk if the datatype has been registered
       
  1021         */
       
  1022         IMPORT_C TInt RegisterDataType(
       
  1023             const TDataType& aDataType);
       
  1024 
       
  1025     
       
  1026         /**
       
  1027         * UnRegisterDataType
       
  1028         *
       
  1029         * Unregisters a datatype via its index.
       
  1030         *
       
  1031         * @since  2.5
       
  1032         * @param  aIndex: Number of the datatype to unregister
       
  1033         * @return EOk if the datatype has been unregistered
       
  1034         */
       
  1035         IMPORT_C TInt UnRegisterDataType(
       
  1036             const TInt aIndex);
       
  1037 
       
  1038 
       
  1039         /**
       
  1040         * SupportedDRMMethods
       
  1041         *
       
  1042         * Returns the supported DRM protection methods and the OMA compliance
       
  1043         * level of the DRM engine
       
  1044         *
       
  1045         * @since  2.0
       
  1046         * @param  aDRMMethod: Out parameter, bit mask containing any 
       
  1047         *         combination of EForwardLock, ECombinedDelivery, 
       
  1048         *         ESeparateDelivery etc.
       
  1049         * @param  aOMALevel: OMA compliance of the DRM engine
       
  1050         * @return DRMCommon error code
       
  1051         */
       
  1052     
       
  1053         IMPORT_C TInt SupportedDRMMethods2(
       
  1054             TInt& aDRMMethod, TDRMHelperOMALevel& aOMALevel);
       
  1055 
       
  1056     
       
  1057         /**
       
  1058         * Consume2
       
  1059         *
       
  1060         * Overrides any rights consumption. This function must only be used by
       
  1061         * applications with user interaction and not by intermediate components.
       
  1062         * The main use cases are signalling that content is to be installed
       
  1063         * (including thumbnail generation), or that content is to be consumed.
       
  1064         * They are characterized as calls to this function with the correct
       
  1065         * intent (i.e. EPlay or EInstall) and the corresponding action (i.e.
       
  1066         * telling whether the indicated intent is started or finished).
       
  1067         * Calls to this function must be the result of a user interaction or
       
  1068         * otherwise high level event.
       
  1069         *
       
  1070         * @since  3.0
       
  1071         * @param  aContentURI: URI of the content which will be consumed
       
  1072         * @param  aRightsSpec: the consumption intent (EPlay, EDisplay, EPrint,
       
  1073         *         EExecute or EInstall)
       
  1074         * @param  anAction: the consumption action, telling whether the
       
  1075         *         content consumption starts or finishes.
       
  1076         * @return EOk if consume action was successfully signalled to the engine.
       
  1077         */
       
  1078         IMPORT_C TInt Consume2(
       
  1079 		    const TDesC8& aContentURI,
       
  1080 		    TUint32 aRightsSpec,
       
  1081 		    TDRMHelperConsumeAction anAction);
       
  1082 
       
  1083 
       
  1084         /**
       
  1085         * ConsumeFile2
       
  1086         *
       
  1087         * Overrides any rights consumption. This function must only be used by
       
  1088         * applications with user interaction and not by intermediate components.
       
  1089         * The main use cases are signalling that content is to be installed
       
  1090         * (including thumbnail generation), or that content is to be consumed.
       
  1091         * They are characterized as calls to this function with the correct
       
  1092         * intent (i.e. EPlay or EInstall) and the corresponding action (i.e.
       
  1093         * telling whether the indicated intent is started or finished).
       
  1094         * Calls to this function must be the result of a user interaction or
       
  1095         * otherwise high level event.
       
  1096         *
       
  1097         * @since  3.0
       
  1098         * @param  
       
  1099         * @param  aRightsSpec: the consumption intent (EPlay, EDisplay, EPrint,
       
  1100         *         EExecute or EInstall)
       
  1101         * @param  anAction: the consumption action, telling whether the
       
  1102         *         content consumption starts or finishes.
       
  1103         * @return EOk if consume action was successfully signalled to the engine.
       
  1104         */
       
  1105         IMPORT_C TInt ConsumeFile2(
       
  1106 		    const TDesC& aFileName,
       
  1107 		    TUint32 aRightsSpec,
       
  1108 		    TDRMHelperConsumeAction anAction);
       
  1109 
       
  1110 
       
  1111         /**
       
  1112         * ConsumeFile2
       
  1113         *
       
  1114         * Overrides any rights consumption. This function must only be used by
       
  1115         * applications with user interaction and not by intermediate components.
       
  1116         * The main use cases are signalling that content is to be installed
       
  1117         * (including thumbnail generation), or that content is to be consumed.
       
  1118         * They are characterized as calls to this function with the correct
       
  1119         * intent (i.e. EPlay or EInstall) and the corresponding action (i.e.
       
  1120         * telling whether the indicated intent is started or finished).
       
  1121         * Calls to this function must be the result of a user interaction or
       
  1122         * otherwise high level event.
       
  1123         *
       
  1124         * @since  3.0
       
  1125         * @param  aFileHandle: file handle to the file
       
  1126         * @param  aRightsSpec: the consumption intent (EPlay, EDisplay, EPrint,
       
  1127         *         EExecute or EInstall)
       
  1128         * @param  anAction: the consumption action, telling whether the
       
  1129         *         content consumption starts or finishes.
       
  1130         * @return EOk if consume action was successfully signalled to the engine.
       
  1131         */
       
  1132         IMPORT_C TInt ConsumeFile2(
       
  1133 		    RFile& aFileHandle, 
       
  1134 		    TUint32 aRightsSpec,
       
  1135 		    TDRMHelperConsumeAction anAction);
       
  1136 
       
  1137 		/**
       
  1138         * Acquires rights for given content if rights have been expired or rights are missing.
       
  1139 		* If content already has valid or future rights, does nothing.
       
  1140 		* This function should be called when user selects activate from options menu.
       
  1141 		* Leaves with system-wide error code in case of error.
       
  1142         * @param aContent: Content object
       
  1143         */
       
  1144 		IMPORT_C void ActivateContentL(CData& aContent);
       
  1145 
       
  1146 		/**
       
  1147         * Acquires rights for given content if rights have been expired or rights are missing.
       
  1148 		* If content already has valid or future rights, does nothing.
       
  1149 		* This function should be called when user selects activate from options menu.
       
  1150 		* Leaves with system-wide error code in case of error.
       
  1151         * @param aFileName: Full path to file
       
  1152         */
       
  1153 		IMPORT_C void ActivateContentL(TDesC& aFileName);
       
  1154 
       
  1155 		/**
       
  1156         * Checks if given content has embedded preview or if it is possible to get preview rights for it.
       
  1157 		* Leaves with system-wide error code in case of error.
       
  1158         * @param aContent: Content object
       
  1159 		* @param aPreviewUri: Out: URI of the embedded preview or PreviewRights URL. Must be freed by caller
       
  1160 		* @return preview type
       
  1161         */
       
  1162 		IMPORT_C TDRMHelperPreviewType HasPreviewL(CData& aContent, HBufC8*& aPreviewUri);
       
  1163 
       
  1164 		/**
       
  1165         * Checks if given content has embedded preview or if it is possible to get preview rights for it.
       
  1166 		* Leaves with system-wide error code in case of error.
       
  1167         * @param aFileName: Full path to file.
       
  1168 		* @param aPreviewUri: Out: URI of the embedded preview or PreviewRights URL. Must be freed by caller
       
  1169 		* @return preview type
       
  1170         */
       
  1171 		IMPORT_C TDRMHelperPreviewType HasPreviewL(TDesC& aFileName, HBufC8*& aPreviewUri);
       
  1172 
       
  1173 		/**
       
  1174         * Acquires preview rights for given content.
       
  1175 		* Leaves with system-wide error code in case of error.
       
  1176         * @param aContent: Content object
       
  1177         */
       
  1178 		IMPORT_C void GetPreviewRightsL(CData& aContent);
       
  1179 
       
  1180 		/**
       
  1181         * Acquires preview rights for given content.
       
  1182 		* Leaves with system-wide error code in case of error.
       
  1183         * @param aFileName: Full path to file.
       
  1184         */
       
  1185 		IMPORT_C void GetPreviewRightsL(TDesC& aFileName);
       
  1186 
       
  1187 		/**
       
  1188         * This method should be called after embedded preview has been played.
       
  1189 		* It asks from user if he/she wants to buy rights and acquires those if user agrees.
       
  1190 		* Leaves with system-wide error code in case of error.
       
  1191         * @param aContent: Content object.
       
  1192 		* @return ETrue if user selects to buy rights.
       
  1193         */
       
  1194 		IMPORT_C TBool EmbeddedPreviewCompletedL(CData& aContent);
       
  1195 
       
  1196 		/**
       
  1197         * This method should be called after embedded preview has been played.
       
  1198 		* It asks from user if he/she wants to buy rights and acquires those if user agrees.
       
  1199 		* Leaves with system-wide error code in case of error.
       
  1200         * @param aFileName: Full path to file.
       
  1201 		* @return ETrue if user selects to buy rights.
       
  1202         */
       
  1203 		IMPORT_C TBool EmbeddedPreviewCompletedL(TDesC& aFileName);
       
  1204 
       
  1205 		/**
       
  1206         * Checks if given content has InfoUrl.
       
  1207 		* Leaves with system-wide error code in case of error.
       
  1208         * @param aContent: Content object.
       
  1209 		* @param aInfoUrl: Out: InfoUrl. Must be freed by caller.
       
  1210 		* @return ETrue if content has InfoUrl.
       
  1211         */
       
  1212 		IMPORT_C TBool HasInfoUrlL(CData& aContent, HBufC8*& aInfoUrl);
       
  1213 
       
  1214 		/**
       
  1215         * Checks if given content has InfoUrl.
       
  1216 		* Leaves with system-wide error code in case of error.
       
  1217         * @param aFileName: Full path to file.
       
  1218 		* @param aInfoUrl: Out: InfoUrl. Must be freed by caller.
       
  1219 		* @return ETrue if content has InfoUrl.
       
  1220         */
       
  1221 		IMPORT_C TBool HasInfoUrlL(TDesC& aFileName, HBufC8*& aInfoUrl);
       
  1222 
       
  1223 		/**
       
  1224         * Opens browser with InfoUrl of the content.
       
  1225 		* Leaves with system-wide error code in case of error.
       
  1226         * @param aContent: Content object.
       
  1227         */
       
  1228 		IMPORT_C void OpenInfoUrlL(CData& aContent);
       
  1229 
       
  1230 		/**
       
  1231         * Opens browser with InfoUrl of the content.
       
  1232 		* Leaves with system-wide error code in case of error.
       
  1233         * @param aFileName: Full path to file.
       
  1234         */
       
  1235 		IMPORT_C void OpenInfoUrlL(TDesC& aFileName);
       
  1236 
       
  1237         /**
       
  1238         * Sets the type of automated content to be registered. This method 
       
  1239         * should be called before calling any of SetAutomated* methods.
       
  1240         * @param  aAutomatedType: type of automated content
       
  1241         * @return System wide error code
       
  1242         * @since Series 60 3.0
       
  1243         */
       
  1244         IMPORT_C TInt SetAutomatedType( TDRMHelperAutomatedType aAutomatedType );
       
  1245         
       
  1246         /**
       
  1247         * Sets media type of content for preview. Should be called prior to 
       
  1248         * calling HandleErrorOrPreviewL or EmbeddedPreviewCompletedL. 
       
  1249         * @param aMediaType: media type of content.
       
  1250         * @return System wide error code
       
  1251         * @since S60 3.1u
       
  1252         */
       
  1253         IMPORT_C TInt SetPreviewMediaType( 
       
  1254             TDRMHelperPreviewMediaType aMediaType );
       
  1255 
       
  1256     protected:  // New functions
       
  1257         
       
  1258         /**
       
  1259         * ?member_description.
       
  1260         * @since ?Series60_version
       
  1261         * @param ?arg1 ?description
       
  1262         * @return ?description
       
  1263         */
       
  1264         //?type ?member_function( ?type ?arg1 );
       
  1265 
       
  1266     protected:  // Functions from base classes
       
  1267         
       
  1268         /**
       
  1269         * From ?base_class ?member_description
       
  1270         */
       
  1271         //?type ?member_function();
       
  1272 
       
  1273 
       
  1274     private:
       
  1275 
       
  1276         /**
       
  1277         * C++ default constructor.
       
  1278         */
       
  1279         CDRMHelper( CCoeEnv& aCoeEnv );
       
  1280         CDRMHelper();
       
  1281 
       
  1282         /**
       
  1283         * By default Symbian 2nd phase constructor is private.
       
  1284         */
       
  1285         void ConstructL( RFs* aFs );
       
  1286 
       
  1287         // Prohibit copy constructor if not deriving from CBase.
       
  1288         // ?classname( const ?classname& );
       
  1289         // Prohibit assigment operator if not deriving from CBase.
       
  1290         // ?classname& operator=( const ?classname& );
       
  1291 
       
  1292         /**
       
  1293         * Display query dialog
       
  1294         */
       
  1295         TInt DisplayQueryWithIdL( TInt aTextResourceId, TInt aQueryResourceId );
       
  1296         TInt DisplayQueryWithIdValueL( TInt aTextResourceId, TInt aQueryResourceId, 
       
  1297                                        const TDesC& aString );
       
  1298         TInt DisplayQueryL( TInt aTextResourceId, TInt aValue );
       
  1299         TInt DisplayQueryL( TInt aTextResourceId, const TDesC& aString );
       
  1300         TInt DisplayQueryL( 
       
  1301         	TInt aTextResourceId, 
       
  1302         	const TDesC& aString, 
       
  1303             TInt aValue,
       
  1304         	TInt aStringPos = -1,
       
  1305         	TInt aValuePos = -1 );
       
  1306         TInt DisplayQueryL( TDesC& aPromptText, TInt aQueryResourceId );
       
  1307 
       
  1308         /**
       
  1309         * Display information note
       
  1310         */
       
  1311         void DisplayInfoNoteL( TInt aTextResourceId );
       
  1312         void DisplayInfoNoteL( TInt aTextResourceId, const TDesC& aString );
       
  1313         void DisplayInfoNoteL( TInt aTextResourceId, TInt aValue );
       
  1314         void DisplayInfoNoteL( TDesC& aPromptText, TInt aResourceId, 
       
  1315                                const TDesC& aString = KNullDesC, TInt aValue = -1 );
       
  1316 
       
  1317         /**
       
  1318         * Launch browser embedded
       
  1319         */
       
  1320         void LaunchBrowserL( HBufC8* aUrl );
       
  1321         void LaunchBrowserL( HBufC* aUrl );
       
  1322 
       
  1323         /**
       
  1324         * Get rights-issuer URI from DCF file
       
  1325         */
       
  1326         void GetRightsIssuerL( const CData& aContent, HBufC*& aIssuer );
       
  1327 
       
  1328         /**
       
  1329         * Get time and count based constraints
       
  1330         */
       
  1331         TInt GetCounts( CDRMRightsConstraints* aConstraint, 
       
  1332             TUint32& aOriginalCount, TTimeIntervalDays& aDuration );
       
  1333 
       
  1334         TInt GetCounts( CDRMRightsConstraints* aConstraint,
       
  1335             TUint32& aCountLeft, TTime& aEndTime );
       
  1336             
       
  1337         TInt GetCounts( CDRMConstraint* aConstraint, 
       
  1338             TUint32& aOriginalCount, TTimeIntervalDays& aDuration );
       
  1339 
       
  1340         TInt GetCounts( CDRMConstraint* aConstraint,
       
  1341             TUint32& aCountLeft, TTime& aEndTime );
       
  1342 
       
  1343         /**
       
  1344         * Launch rights manager UI
       
  1345         */
       
  1346         void LaunchRightsManagerUiL( const TDesC& aParam16 );
       
  1347 
       
  1348         /**
       
  1349         * Form string needed to launch rights manager UI embedded.
       
  1350         */
       
  1351         void CreateLaunchParamL( TUint32 aLocalId, const HBufC8* aUrl, 
       
  1352             HBufC*& aLaunchParam );
       
  1353 
       
  1354         /**
       
  1355         * Strip path and extension from given filename.
       
  1356         * Caller is responsible for freeing returned buffer
       
  1357         */
       
  1358         TPtrC StripPathAndExtension( const TDesC& aFileName );
       
  1359 
       
  1360         /**
       
  1361         * Get expiration details of file.
       
  1362         * Returns DRMCommon::ENoRights if no rights object found or
       
  1363         * CDRMRights::TExpiration value
       
  1364         */
       
  1365         TInt GetExpirationDetails( HBufC8* aContentUri, TInt aIntent, 
       
  1366                                    CDRMRights*& aRightsObject );
       
  1367 
       
  1368         /**
       
  1369         * Get expiration time of given rights object
       
  1370         */
       
  1371         TInt CalculateEndTime( CDRMRights* aRights, TInt aIntent, 
       
  1372             TTime& aEndTime, TBool& aInactive );
       
  1373 
       
  1374         /**
       
  1375         * Get end time of given constraint
       
  1376         */
       
  1377         TInt GetEndTime( CDRMRightsConstraints* aConstraint, 
       
  1378             TTime& aEndTime, TBool& aInactive );
       
  1379         
       
  1380         /**
       
  1381         * Register content as automated
       
  1382         */
       
  1383         TInt PerformSetAutomatedL( const CData& aContent, TBool aActive );
       
  1384         TInt DoSetAutomatedL( const TDesC8& aURI, TBool aActive, 
       
  1385             const HBufC* aMimeType );
       
  1386 
       
  1387         /**
       
  1388         * Display confirmation query about setting as automated. Does not 
       
  1389         * actually register.
       
  1390         */
       
  1391         TInt PerformShowAutomatedNoteL( const CData& aContent );
       
  1392         TInt DoShowAutomatedNoteL( const TDesC8& aURI, 
       
  1393             const HBufC* aMimeType );
       
  1394 
       
  1395         /**
       
  1396         * Register content as automated without showing any queries
       
  1397         */
       
  1398         TInt PerformSetAutomatedSilentL( const CData& aContent, TBool aActive );
       
  1399         TInt DoSetAutomatedSilent( const TDesC8& aURI, TBool aActive, TInt aIntent );
       
  1400 
       
  1401         /**
       
  1402         * Returns default intent for the mimetype
       
  1403         */
       
  1404         TInt Intent( const HBufC* aMimeType );
       
  1405         
       
  1406         /**
       
  1407         * Checks if content can be used as automated content
       
  1408         */
       
  1409         TInt PerformCanSetAutomatedL( const CData& aContent,TBool& aValue );
       
  1410         TInt DoCanSetAutomated( const TDesC8& aURI, const HBufC* aMimeType, 
       
  1411             TBool& aValue );
       
  1412         TBool DoCheckSkinCanSetAutomated(CDRMRights* aRights);
       
  1413             
       
  1414         /**
       
  1415         * Gets mimetype based on content URI
       
  1416         */
       
  1417         HBufC* MimeTypeFromURIL( const TDesC8& aURI );
       
  1418         
       
  1419         /**
       
  1420         * Gets corresponding filename (including full path) based on content 
       
  1421         * URI
       
  1422         */
       
  1423         TInt GetFileHandleFromURIL( const TDesC8& aURI, RFile& aFileHandle );
       
  1424 
       
  1425         /**
       
  1426         * Get start time of given rights object
       
  1427         */
       
  1428         TInt GetStartTime( CDRMRights* aRights, TInt aIntent, 
       
  1429             TTime& aStartTime );
       
  1430 
       
  1431         /**
       
  1432         * Displays info note of rights that are not yet valid 
       
  1433         */
       
  1434         TInt ShowFutureNoteL( const HBufC* aMimeType, CDRMRights* aRightsObject );
       
  1435 
       
  1436         /**
       
  1437         * Handles error by displaying appropriate note to user.
       
  1438         */
       
  1439         TInt DoHandleErrorL( TInt aError, HBufC8* aContentUri, HBufC* aMimeType, 
       
  1440             HBufC* aRIUrl, HBufC* aDomainRoUrl, HBufC* aEta, HBufC8* aRiId8,
       
  1441             HBufC8* aDomainId8, const TDesC& aFileName );
       
  1442             
       
  1443         /**
       
  1444         * Checks if rights are about to expire.
       
  1445         */
       
  1446         TInt DoCheckRightsPercentL( HBufC8* aContentUri, HBufC* aMimeType, 
       
  1447             HBufC* aRIUrl, const TDesC& aFileName, TInt aThreshold );
       
  1448 
       
  1449         TInt DoCheckRightsAmountL( HBufC8* aContentUri, HBufC* aMimeType, 
       
  1450             HBufC* aRIUrl, const TDesC& aFileName, TInt aCount, TInt aDays );
       
  1451             
       
  1452         /**
       
  1453         * Gets rights details.
       
  1454         */
       
  1455         void DoGetRightsDetailsL( HBufC8* aContentUri, TUint32 aIntent,
       
  1456             TBool& aExpired, CDRMHelperRightsConstraints*& aPlay,
       
  1457             CDRMHelperRightsConstraints*& aDisplay, 
       
  1458             CDRMHelperRightsConstraints*& aExecute,
       
  1459             CDRMHelperRightsConstraints*& aPrint );
       
  1460 
       
  1461         void DoGetRightsDetailsL( CData* aContent, TUint32 aIntent,
       
  1462             TBool& aExpired, TBool& aSendingAllowed, CDRMRightsConstraints*& aPlay,
       
  1463             CDRMRightsConstraints*& aDisplay, 
       
  1464             CDRMRightsConstraints*& aExecute,
       
  1465             CDRMRightsConstraints*& aPrint );
       
  1466 		
       
  1467         /**
       
  1468         * Get constraints for given rights
       
  1469         */
       
  1470         void GetConstraintsL( 
       
  1471             CDRMRights& aRights, 
       
  1472             CDRMHelperRightsConstraints*& aPlay,
       
  1473             CDRMHelperRightsConstraints*& aDisplay,
       
  1474             CDRMHelperRightsConstraints*& aExecute,
       
  1475             CDRMHelperRightsConstraints*& aPrint );
       
  1476 
       
  1477 		/**
       
  1478 		* Unregisters automated content.
       
  1479 		*/
       
  1480 		TInt PerformRemoveAutomatedL( const CData& aContent, TBool aActive );
       
  1481 		
       
  1482 		void HandleServerAppExit(TInt aReason);
       
  1483 
       
  1484         void CheckPreviewUriL( 
       
  1485             const CData* aContent, 
       
  1486             HBufC*& aEmbeddedPreviewUri, 
       
  1487             TInt& aPreviewType );
       
  1488         
       
  1489         TInt DisplayPopupWindowsForPreviewL(TInt aPreviewType);
       
  1490 
       
  1491         /**
       
  1492 		* Returns correct resource id for automated content notes.
       
  1493 		* If aExpired is ETrue, aSecondParameter indicates if RI URL exists
       
  1494 		* If aExpired is EFalse, aSecondParameter indicates if there is one day left
       
  1495         * aRejectReason tells the constraints which are invalid.
       
  1496 		*/
       
  1497 		TInt AutomatedResIdL( TBool aExpired, TBool aSecondParameter, TUint32 aRejectReason );
       
  1498 
       
  1499         /** 
       
  1500         * Returns the correct resource id for expired and no rights notes
       
  1501         */		    
       
  1502         TInt ErrorResIdL( const TDesC8& aContentUri, TInt aIntent, 
       
  1503             TBool aRightsIssuer, TBool aExpired );
       
  1504 
       
  1505         /** 
       
  1506         * Returns the constraints which are invalid
       
  1507         */		    
       
  1508         TUint32 RejectReasonL( TInt aIntent, const TDesC8& aContentUri );
       
  1509         
       
  1510         /** 
       
  1511         * Prepares secondary display for DRM notes
       
  1512         */
       
  1513         void PrepareSecondaryDisplayL( CEikDialog& aDialog, TInt aResourceId,
       
  1514                                        const TDesC& aString = KNullDesC, TInt aValue = -1 ); 
       
  1515 
       
  1516         /** 
       
  1517         * Cancels secondary display for DRM notes
       
  1518         */
       
  1519         void CancelSecondaryDisplayL( TInt aResourceId );
       
  1520                 
       
  1521         /** 
       
  1522         * Check whether a file as a silent rights URL which can be used, i.e the URL is valid
       
  1523         * and on the white list.
       
  1524         */
       
  1525         HBufC8* HasSilentRightsUrlL( CData* aContent );
       
  1526         
       
  1527         /** 
       
  1528         * Get rights silently
       
  1529         */
       
  1530         TInt GetSilentRightsL( const TDesC8& aUrl );
       
  1531 
       
  1532         /** 
       
  1533         * Check if the user has allowed silent rights
       
  1534         */
       
  1535         TBool SilentRightsAllowedL();
       
  1536 
       
  1537         /** 
       
  1538         * Check if browser AP has been defined
       
  1539         */
       
  1540         TBool BrowserAPDefinedL();
       
  1541 
       
  1542     protected:  // Data
       
  1543         // ?one_line_short_description_of_data
       
  1544         //?data_declaration;
       
  1545 
       
  1546     private:    // Data
       
  1547         CCoeEnv*                iCoeEnv;
       
  1548 
       
  1549         // DRM engine
       
  1550         DRMCommon*              iDRMCommon;
       
  1551 
       
  1552         // used to make launching rights manager ui synchronous
       
  1553         CActiveSchedulerWait    iWait;
       
  1554    
       
  1555         RDRMHelper              iHelperServer;
       
  1556         
       
  1557         // is CoeEnv used
       
  1558         TBool                   iUseCoeEnv;
       
  1559 
       
  1560         // Used to read resources when CoeEnv is not available
       
  1561         CStringResourceReader*  iStringResourceReader;
       
  1562         
       
  1563         TBool                   iOma2;
       
  1564         	
       
  1565         RPointerArray<CConsumeData> iConsumeList;
       
  1566         
       
  1567         TInt                    iAutomatedType;
       
  1568    
       
  1569         RFs                     iFs;
       
  1570         
       
  1571         TBool                   iFsOwned;
       
  1572         
       
  1573         TInt                    iPreviewMediaType;
       
  1574         
       
  1575         // Used to queue up global notes
       
  1576         RPointerArray<CDRMHelperInfoNoteWrapper>      iNoteList;
       
  1577         
       
  1578         CSchemeHandler*         iSchemeHandler;
       
  1579 
       
  1580         TBool                   iReturnCancel;
       
  1581 
       
  1582         // Used to send cancel events to cover ui
       
  1583         CMediatorEventProvider* iEventProvider;
       
  1584 
       
  1585     public:     // Friend classes
       
  1586     protected:  // Friend classes
       
  1587     private:    // Friend classes
       
  1588 
       
  1589     };
       
  1590 
       
  1591 #endif      // __DRMHELPER_H__   
       
  1592             
       
  1593 // End of File
       
  1594