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