1.1 --- a/epoc32/include/mw/drmhelper.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/drmhelper.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,1594 @@
1.4 -drmhelper.h
1.5 +/*
1.6 +* Copyright (c) 2003, 2004 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description: Class to show miscellaneous DRM related error notes and
1.19 +* details about rights
1.20 +*
1.21 +*/
1.22 +
1.23 +
1.24 +
1.25 +#ifndef __DRMHELPER_H__
1.26 +#define __DRMHELPER_H__
1.27 +
1.28 +// INCLUDES
1.29 +#include <e32base.h>
1.30 +#include <ConeResLoader.h>
1.31 +#include <apparc.h>
1.32 +#include <rdrmhelper.h>
1.33 +#include <aknserverapp.h>
1.34 +#include <caf/caf.h>
1.35 +#include <caf/content.h>
1.36 +#include <caf/data.h>
1.37 +#include <eikdialg.h>
1.38 +
1.39 +using namespace ContentAccess;
1.40 +
1.41 +// CONSTANTS
1.42 +const TInt KDRMHelperDefaultCountThreshold = 3;
1.43 +const TInt KDRMHelperDefaultTimeThreshold = 7;
1.44 +const TInt KDRMHelperDefaultPercentageThreshold = 10;
1.45 +const TInt KDRMHelperNoteMaxSize ( 256 );
1.46 +
1.47 +// MACROS
1.48 +
1.49 +// DATA TYPES
1.50 +enum TDRMHelperPreviewMediaType
1.51 + {
1.52 + EPreviewTypeAudio,
1.53 + EPreviewTypeVideo
1.54 + };
1.55 +// FUNCTION PROTOTYPES
1.56 +
1.57 +// FORWARD DECLARATIONS
1.58 +class DRMCommon;
1.59 +class CDRMRightsConstraints;
1.60 +class CDRMRights;
1.61 +class CStringResourceReader;
1.62 +class TDataType;
1.63 +class CCoeEnv;
1.64 +class CConsumeData;
1.65 +class CDRMPermission;
1.66 +class CDRMConstraint;
1.67 +class CAknGlobalNote;
1.68 +class CAknWaitDialog;
1.69 +class CDRMHelperInfoNoteWrapper;
1.70 +class CSchemeHandler;
1.71 +class CMediatorEventProvider;
1.72 +
1.73 +// CLASS DECLARATION
1.74 +
1.75 +/**
1.76 +* Helper class for wrapping CDRMRightsConstraints.
1.77 +*
1.78 +* @lib drmhelper.lib
1.79 +* @since Series 60 2.1
1.80 +*/
1.81 +class CDRMHelperRightsConstraints : public CBase
1.82 + {
1.83 + public: // Constructors and destructor
1.84 +
1.85 + /**
1.86 + * Two-phased constructor.
1.87 + */
1.88 + static CDRMHelperRightsConstraints* NewL(
1.89 + CDRMRightsConstraints* aConstraints );
1.90 + static CDRMHelperRightsConstraints* NewLC(
1.91 + CDRMRightsConstraints* aConstraints );
1.92 +
1.93 + /**
1.94 + * Destructor.
1.95 + */
1.96 + IMPORT_C ~CDRMHelperRightsConstraints();
1.97 +
1.98 + public: // New functions
1.99 +
1.100 + /**
1.101 + * checks if the object contains any restrictions
1.102 + * or if usage is unconstrained.
1.103 + * @return ETrue if usage is unconstrained
1.104 + */
1.105 + IMPORT_C TBool FullRights();
1.106 +
1.107 + /**
1.108 + * checks if the object contains only preview rights
1.109 + * @return ETrue if object contains only preview rights
1.110 + */
1.111 + IMPORT_C TBool IsPreview();
1.112 +
1.113 + /**
1.114 + * Gets number of counts left and number of original counts.
1.115 + * Leaves with KErrNotFound if object doesn't have count based rights.
1.116 + * @param aCounter: (out) counts left
1.117 + * @param aOriginalCounter: (out) number of counts when stored to
1.118 + * rights db
1.119 + * @return -
1.120 + */
1.121 + IMPORT_C void GetCountersL( TUint32& aCounter,
1.122 + TUint32& aOriginalCounter );
1.123 +
1.124 + /**
1.125 + * Gets start time of time based rights.
1.126 + * Leaves with KErrNotFound if object doesn't have time based rights.
1.127 + * @param aStartTime: (out) start time
1.128 + * @return -
1.129 + */
1.130 + IMPORT_C void GetStartTimeL( TTime& aStartTime );
1.131 +
1.132 + /**
1.133 + * Gets end time of time based rights.
1.134 + * Leaves with KErrNotFound if object doesn't have time based rights.
1.135 + * @param aEndTime: (out) start time
1.136 + * @return -
1.137 + */
1.138 + IMPORT_C void GetEndTimeL( TTime& aEndTime );
1.139 +
1.140 + /**
1.141 + * Gets interval time constraint.
1.142 + * Leaves with KErrNotFound if object doesn't have interval constraint.
1.143 + * @param aInterval: (out) interval
1.144 + * @return -
1.145 + */
1.146 + IMPORT_C void GetIntervalL( TTimeIntervalSeconds& aInterval );
1.147 +
1.148 + /**
1.149 + * Gets start time of activated interval constraint.
1.150 + * Leaves with KErrNotFound if interval has not been started yet.
1.151 + * @param aStartTime: (out) start time of activated interval
1.152 + * @return -
1.153 + */
1.154 +
1.155 + IMPORT_C void GetIntervalStartL( TTime& aStartTime );
1.156 + /**
1.157 + * Gets number of counts left, number of original counts and timer
1.158 + * value for timed-count constraint.
1.159 + * Leaves with KErrNotFound if object doesn't have timed-count
1.160 + * constraint.
1.161 + * @param aCounter: (out) counts left
1.162 + * @param aOriginalCounter: Invalid, value returned same as aCounter
1.163 + * @param aTimer: (out) timer value
1.164 + * @return -
1.165 + * @since Series 60 3.0
1.166 + */
1.167 + IMPORT_C void GetTimedCountL( TUint32& aCounter,
1.168 + TUint32& aOriginalCounter, TTimeIntervalSeconds& aTimer );
1.169 +
1.170 + /**
1.171 + * Gets accumulated time left.
1.172 + * Leaves with KErrNotFound if object doesn't have accumulated time
1.173 + * constraint.
1.174 + * @param aAccumulatedTime: (out) accumulated time left
1.175 + * @return -
1.176 + * @since Series 60 3.0
1.177 + */
1.178 + IMPORT_C void GetAccumulatedTimeL( TTimeIntervalSeconds& aAccumulatedTime );
1.179 +
1.180 + private:
1.181 +
1.182 + /**
1.183 + * C++ default constructor.
1.184 + */
1.185 + CDRMHelperRightsConstraints( CDRMRightsConstraints* aConstrains );
1.186 +
1.187 + /**
1.188 + * By default Symbian 2nd phase constructor is private.
1.189 + */
1.190 + void ConstructL();
1.191 +
1.192 + private: // Data
1.193 + // pointer to CDRMRightsConstraints object
1.194 + CDRMRightsConstraints* iConstraints;
1.195 + };
1.196 +
1.197 +
1.198 +/**
1.199 +* Handles some error situations DRM-aware applications may encounter.
1.200 +*
1.201 +* @lib drmhelper.lib
1.202 +* @since Series 60 2.1
1.203 +*/
1.204 +class CDRMHelper : public CBase, public MAknServerAppExitObserver
1.205 + {
1.206 + public: // Data
1.207 +
1.208 + enum TDRMHelperNotificationID
1.209 + {
1.210 + ETActivateTextId = 1,
1.211 + ETCountBasedErrorTextId = 2 ,
1.212 + ETCountUsageReduceId = 3,
1.213 + ETCountUsageReduceMediaId = 4
1.214 + };
1.215 +
1.216 + enum TDRMHelperConsumeAction
1.217 + {
1.218 + EStart,
1.219 + EFinish,
1.220 + EPause,
1.221 + EContinue
1.222 + };
1.223 +
1.224 + enum TDRMHelperOMALevel
1.225 + {
1.226 + EOMA_None,
1.227 + EOMA_1_0,
1.228 + EOMA_2_0
1.229 + };
1.230 +
1.231 + enum TDRMHelperPreviewType
1.232 + {
1.233 + ENoPreview,
1.234 + EEmbeddedPreview,
1.235 + EPreviewRights
1.236 + };
1.237 +
1.238 + enum TDRMHelperAutomatedType
1.239 + {
1.240 + EAutomatedTypeRingingTone,
1.241 + EAutomatedTypeMessageAlert,
1.242 + EAutomatedTypeEmailAlert,
1.243 + EAutomatedTypeIMAlert,
1.244 + EAutomatedTypeCalendarAlarm,
1.245 + EAutomatedTypeScreenSaver,
1.246 + EAutomatedTypeWallpaper,
1.247 + EAutomatedTypeTheme,
1.248 + EAutomatedTypeClockAlarm,
1.249 + EAutomatedTypeOther = KMaxTUint8
1.250 + };
1.251 +
1.252 + enum TDRMHelperDRMMethods
1.253 + {
1.254 + EForwardLock = 0x0001,
1.255 + ECombinedDelivery = 0x0002,
1.256 + ESeparateDelivery = 0x0004,
1.257 + ESuperDistribution = 0x0008
1.258 + };
1.259 +
1.260 + public: // Constructors and destructor
1.261 +
1.262 + /**
1.263 + * Two-phased constructor.
1.264 + */
1.265 + IMPORT_C static CDRMHelper* NewL( CCoeEnv& aCoeEnv );
1.266 + IMPORT_C static CDRMHelper* NewLC( CCoeEnv& aCoeEnv );
1.267 +
1.268 + /**
1.269 + * Two-phased constructor.
1.270 + * @since Series 60 2.6
1.271 + */
1.272 + IMPORT_C static CDRMHelper* NewL();
1.273 + IMPORT_C static CDRMHelper* NewLC();
1.274 +
1.275 + /**
1.276 + * Two-phased constructor.
1.277 + * @since Series 60 3.0
1.278 + */
1.279 + IMPORT_C static CDRMHelper* NewL( CCoeEnv& aCoeEnv, RFs& aFs );
1.280 + IMPORT_C static CDRMHelper* NewLC( CCoeEnv& aCoeEnv, RFs& aFs );
1.281 +
1.282 + /**
1.283 + * Two-phased constructor.
1.284 + * @since Series 60 3.0
1.285 + */
1.286 + IMPORT_C static CDRMHelper* NewL( RFs& aFs );
1.287 + IMPORT_C static CDRMHelper* NewLC( RFs& aFs );
1.288 +
1.289 + /**
1.290 + * Destructor.
1.291 + */
1.292 + IMPORT_C ~CDRMHelper();
1.293 +
1.294 +
1.295 + public:
1.296 +
1.297 + /**
1.298 + * Displays appropriate error note depending on error code.
1.299 + * @param aError: error code returned by DRM engine
1.300 + * @param aURI: URI of the file
1.301 + * @return
1.302 + * - Button code, if user selected "buy rights" or "launch rights
1.303 + * manager" in query.
1.304 + * - 0 if user selected "No", "Back" or "Cancel" (or whatever which
1.305 + * just dismiss the query)
1.306 + * - 0 if just a simple error note is displayed
1.307 + */
1.308 + IMPORT_C TInt HandleErrorL( TInt aError,
1.309 + const TDesC8& aURI );
1.310 +
1.311 +
1.312 + /**
1.313 + * Displays:
1.314 + * Handles error situations 'rights expired', 'no rights' and
1.315 + * 'rights database corrupted'.
1.316 + * @param aError: error code returned by DRM engine
1.317 + * @param aFileName: full path to file
1.318 + * @return
1.319 + * - Button code, if user selected "buy rights" or "launch rights
1.320 + * manager" in query.
1.321 + * - 0 if user selected "No", "Back" or "Cancel" (or whatever which
1.322 + * just dismiss the query)
1.323 + * - 0 if just a simple error note is displayed
1.324 + */
1.325 + IMPORT_C TInt HandleErrorL( TInt aError,
1.326 + const TDesC& aFileName );
1.327 +
1.328 +
1.329 + /**
1.330 + * Displays:
1.331 + * Handles error situations 'rights expired', 'no rights' and
1.332 + * 'rights database corrupted'.
1.333 + * @param aError: error code returned by DRM engine
1.334 + * @param aFileHandle: file handle to the file
1.335 + * @return
1.336 + * - Button code, if user selected "buy rights" or "launch rights
1.337 + * manager" in query.
1.338 + * - 0 if user selected "No", "Back" or "Cancel" (or anything that
1.339 + * just dismisses the query)
1.340 + * - 0 if just a simple error note is displayed
1.341 + * @since 3.0
1.342 + */
1.343 + IMPORT_C TInt HandleErrorL( TInt aError,
1.344 + RFile& aFileHandle );
1.345 +
1.346 + /**
1.347 + * Handles DRM-specific error situations. Should be called instead of
1.348 + * HandleErrorL if user should be asked to play embedded preview or get
1.349 + * preview/silent rights if there is no valid rights and either embedded preview or
1.350 + * preview rights are available.
1.351 + * @param aError: error code to be handled.
1.352 + * @param aFile: handle of file for which error was received.
1.353 + * @param aEmbeddedPreviewUri: contain URI of embedded preview part
1.354 + * upon return if caller should play the embedded preview. If embedded
1.355 + * preview should not be played this is NULL. Must be freed by caller.
1.356 + * @return KErrNone if the content is now usable (e.g. silent rights or preview rights were gotten). If
1.357 + * the return code is KErrNone and the aEmbeddedPreviewUri parameter is not NULL,
1.358 + * the player should use embedded preview
1.359 + * KErrCancel if the user cancelled any of the actions within the function
1.360 + * KErrCANoRights and KErrCANoPermission if after the function call, still no rights exist
1.361 + * KErrCompletion if the user did launch the browser, but it is not clear whether the content
1.362 + * was activated
1.363 + * @since S60 3.1
1.364 + */
1.365 + IMPORT_C TInt HandleErrorOrPreviewL(
1.366 + TInt aError,
1.367 + RFile& aFile,
1.368 + HBufC8*& aEmbeddedPreviewUri );
1.369 +
1.370 + /**
1.371 + * Handles DRM specific error situations. Should be called instead of
1.372 + * HandleErrorL if user should be asked to play embedded preview or get
1.373 + * preview/silent rights if there is no valid rights and either embedded preview or
1.374 + * preview rights are available.
1.375 + * @param aError: error code to be handled.
1.376 + * @param aFileName: name of file for which error was received.
1.377 + * @param aEmbeddedPreviewUri: contain URI of embedded preview part
1.378 + * upon return if caller should play the embedded preview. If embedded
1.379 + * preview should not be played this is NULL. Must be freed by caller.
1.380 + * @return KErrNone if the content is now usable (e.g. silent rights or preview rights were gotten). If
1.381 + * the return code is KErrNone and the aEmbeddedPreviewUri parameter is not NULL,
1.382 + * the player should use embedded preview
1.383 + * KErrCancel if the user cancelled any of the actions within the function
1.384 + * KErrCANoRights and KErrCANoPermission if after the function call, still no rights exist
1.385 + * KErrCompletion if the user did launch the browser, but it is not clear whether the content
1.386 + * was activated
1.387 + * @since S60 3.1
1.388 + */
1.389 + IMPORT_C TInt HandleErrorOrPreviewL(
1.390 + TInt aError,
1.391 + const TDesC& aFileName,
1.392 + HBufC8*& aEmbeddedPreviewUri );
1.393 +
1.394 + /**
1.395 + * Check rights for the content. If there is less than given amount
1.396 + * of usage time/count left, appropriate note is displayed
1.397 + * depending on situation.
1.398 + * @param aURI: URI of the file
1.399 + * @return Button code
1.400 + */
1.401 + // causes conflict with other CheckRightsAmount method, removed for now...
1.402 +// IMPORT_C TInt CheckRightsAmountL( const TDesC8& aURI );
1.403 +
1.404 +
1.405 + /**
1.406 + * Check rights for the file. If there is less than given amount
1.407 + * of usage time/count/percentage left, appropriate note is displayed
1.408 + * depending on situation.
1.409 + * @param aFileName: Full path to file
1.410 + * @return Button code
1.411 + */
1.412 + // causes conflict with other CheckRightsAmount method, removed for now...
1.413 +// IMPORT_C TInt CheckRightsAmountL( const TDesC& aFileName );
1.414 +
1.415 +
1.416 + /**
1.417 + * Check rights for the file. If there is less than given amount
1.418 + * of usage time/count/percentage left, appropriate note is displayed
1.419 + * depending on situation.
1.420 + * @param aFileHandle: file handle to the file
1.421 + * @return Button code
1.422 + * @since 3.0
1.423 + */
1.424 + // causes conflict with other CheckRightsAmount method, removed for now...
1.425 +// IMPORT_C TInt CheckRightsAmountL( RFile& aFileHandle );
1.426 +
1.427 +
1.428 + /**
1.429 + * Check rights for the file. If there is less than given amount
1.430 + * of usage time/count left, one of the following note is displayed
1.431 + * depending on situation:
1.432 + * 'Usage rights about to expire. View details?'
1.433 + * 'Usage rights about to expire. %N days left. View details?'
1.434 + * 'Usage rights about to expire. 1 day left. View details?'
1.435 + * 'Usage rights about to expire. %N counts left. View details?'
1.436 + * 'Usage rights about to expire. 1 count left. View details?'
1.437 + * It also checks that rights are valid and displays appropriate note,
1.438 + * if they are not.
1.439 + * @param aFileName: Full path to file
1.440 + * @param aCount: Threshold value for count limit
1.441 + * @param aDays: Threshold value for time limit in days
1.442 + * @return Button code
1.443 + */
1.444 + IMPORT_C TInt CheckRightsAmountL( const TDesC& aFileName,
1.445 + TInt aCount = KDRMHelperDefaultCountThreshold,
1.446 + TInt aDays = KDRMHelperDefaultTimeThreshold );
1.447 +
1.448 +
1.449 + /**
1.450 + * Check rights for the file. If there is less than given amount
1.451 + * of usage time/count left, one of the following note is displayed
1.452 + * depending on situation:
1.453 + * 'Usage rights about to expire. View details?'
1.454 + * 'Usage rights about to expire. %N days left. View details?'
1.455 + * 'Usage rights about to expire. 1 day left. View details?'
1.456 + * 'Usage rights about to expire. %N counts left. View details?'
1.457 + * 'Usage rights about to expire. 1 count left. View details?'
1.458 + * It also checks that rights are valid and displays appropriate note,
1.459 + * if they are not.
1.460 + * @param aFileHandle: file handle to the file
1.461 + * @param aCount: Threshold value for count limit
1.462 + * @param aDays: Threshold value for time limit in days
1.463 + * @return Button code
1.464 + * @since 3.0
1.465 + */
1.466 + IMPORT_C TInt CheckRightsAmountL( RFile& aFileHandle,
1.467 + TInt aCount = KDRMHelperDefaultCountThreshold,
1.468 + TInt aDays = KDRMHelperDefaultTimeThreshold );
1.469 +
1.470 +
1.471 + /**
1.472 + * Check rights for the file. If there is less than given amount
1.473 + * of usage time/count left, one of the following note is displayed
1.474 + * depending on situation:
1.475 + * 'Usage rights about to expire. View details?'
1.476 + * 'Usage rights about to expire. %N days left. View details?'
1.477 + * 'Usage rights about to expire. 1 day left. View details?'
1.478 + * 'Usage rights about to expire. %N counts left. View details?'
1.479 + * 'Usage rights about to expire. 1 count left. View details?'
1.480 + * It also checks that rights are valid and displays appropriate note,
1.481 + * if they are not.
1.482 + * @param aUri: Content URI
1.483 + * @param aCount: Threshold value for count limit
1.484 + * @param aDays: Threshold value for time limit in days
1.485 + * @return Button code
1.486 + */
1.487 + IMPORT_C TInt CheckRightsAmountL( const TDesC8& aUri,
1.488 + TInt aCount = KDRMHelperDefaultCountThreshold,
1.489 + TInt aDays = KDRMHelperDefaultTimeThreshold );
1.490 +
1.491 +
1.492 + /**
1.493 + * Check rights for the file. If there is less than aThreshold percent
1.494 + * of usage time/count left, one of the following note is displayed
1.495 + * depending on situation:
1.496 + * 'Usage rights about to expire. View details?'
1.497 + * 'Usage rights about to expire. %N days left. View details?'
1.498 + * 'Usage rights about to expire. 1 day left. View details?'
1.499 + * 'Usage rights about to expire. %N counts left. View details?'
1.500 + * 'Usage rights about to expire. 1 count left. View details?'
1.501 + * It also checks that rights are valid and displays appropriate note,
1.502 + * if they are not.
1.503 + * @param aFileName: Full path to file
1.504 + * @param aThreshold: Threshold value in percents for displaying the note
1.505 + * @return Button code
1.506 + */
1.507 + IMPORT_C TInt CheckRightsPercentL( const TDesC& aFileName,
1.508 + TInt aThreshold = KDRMHelperDefaultPercentageThreshold );
1.509 +
1.510 +
1.511 + /**
1.512 + * Check rights for the file. If there is less than aThreshold percent
1.513 + * of usage time/count left, one of the following note is displayed
1.514 + * depending on situation:
1.515 + * 'Usage rights about to expire. View details?'
1.516 + * 'Usage rights about to expire. %N days left. View details?'
1.517 + * 'Usage rights about to expire. 1 day left. View details?'
1.518 + * 'Usage rights about to expire. %N counts left. View details?'
1.519 + * 'Usage rights about to expire. 1 count left. View details?'
1.520 + * It also checks that rights are valid and displays appropriate note,
1.521 + * if they are not.
1.522 + * @param aFileHandle: file handle to the file
1.523 + * @param aThreshold: Threshold value in percents for displaying the note
1.524 + * @return Button code
1.525 + * @since 3.0
1.526 + */
1.527 + IMPORT_C TInt CheckRightsPercentL( RFile& aFileHandle,
1.528 + TInt aThreshold = KDRMHelperDefaultPercentageThreshold );
1.529 +
1.530 +
1.531 + /**
1.532 + * Launches DRM Rights Manager UI embedded with details view related
1.533 + * to given content.
1.534 + * @param aURI: URI of the file
1.535 + * @return -
1.536 + */
1.537 + IMPORT_C void LaunchDetailsViewEmbeddedL(
1.538 + const TDesC8& aURI );
1.539 +
1.540 +
1.541 + /**
1.542 + * Launches DRM Rights Manager UI embedded with details view related
1.543 + * to given file.
1.544 + * @param aFileName: Full path to file
1.545 + * @return -
1.546 + */
1.547 + IMPORT_C void LaunchDetailsViewEmbeddedL(
1.548 + const TDesC& aFileName );
1.549 +
1.550 +
1.551 + /**
1.552 + * Launches DRM Rights Manager UI embedded with details view related
1.553 + * to given file.
1.554 + * @param aFileHandle: file handle to the file
1.555 + * @return -
1.556 + * @since 3.0
1.557 + */
1.558 + IMPORT_C void LaunchDetailsViewEmbeddedL(
1.559 + RFile& aFileHandle );
1.560 +
1.561 +
1.562 + /**
1.563 + * Launches DRM Rights Manager UI embedded with details view related
1.564 + * to given content.
1.565 + * @param aContentURI: URI of the content
1.566 + * @return -
1.567 + */
1.568 + IMPORT_C void LaunchDetailsViewEmbeddedL(
1.569 + const HBufC8* aContentURI );
1.570 +
1.571 +
1.572 + /**
1.573 + * Gets details of rights object associated of given file.
1.574 + *
1.575 + * @param[in] aFileName Full path to file
1.576 + * @param[in] aIntent ContentAccess::EPlay, ContentAccess::EView,
1.577 + * ContentAccess::EPrint or ContentAccess::EExecute
1.578 + * @param[out] aExpired ETrue if rights are not valid. If this is ETrue
1.579 + * and some constraints are returned, rights will become valid in future
1.580 + * @param[out] aSendingAllowed ETrue if content can be sent
1.581 + * @param[out] aPlay play constraints, must be deleted by caller
1.582 + * @param[out] aDisplay display constraints, must be deleted by caller
1.583 + * @param[out] aExecute execute constraints, must be deleted by caller
1.584 + * @param[out] aPrint print constraints, must be deleted by caller
1.585 + *
1.586 + * @leave KErrArgument file is not DRM-protected.
1.587 + * @leave KErrCANoRights no rights
1.588 + * @see caferr.h
1.589 + * @see caftypes.h
1.590 + */
1.591 + IMPORT_C void GetRightsDetailsL( const TDesC& aFileName,
1.592 + TUint32 aIntent, TBool& aExpired, TBool& aSendingAllowed,
1.593 + CDRMHelperRightsConstraints*& aPlay,
1.594 + CDRMHelperRightsConstraints*& aDisplay,
1.595 + CDRMHelperRightsConstraints*& aExecute,
1.596 + CDRMHelperRightsConstraints*& aPrint );
1.597 +
1.598 +
1.599 + /**
1.600 + * Gets details of rights object associated of given file.
1.601 + *
1.602 + * @param[in] aFileHandle file handle to the file
1.603 + * @param[in] aIntent ContentAccess::EPlay, ContentAccess::EView,
1.604 + * ContentAccess::EPrint or ContentAccess::EExecute
1.605 + * @param[out] aExpired ETrue if rights are not valid. If this is ETrue
1.606 + * and some constraints are returned, rights will become valid in future
1.607 + * @param[out] aSendingAllowed ETrue if content can be sent
1.608 + * @param[out] aPlay play constraints, must be deleted by caller
1.609 + * @param[out] aDisplay display constraints, must be deleted by caller
1.610 + * @param[out] aExecute execute constraints, must be deleted by caller
1.611 + * @param[out] aPrint print constraints, must be deleted by caller
1.612 + *
1.613 + * @leave KErrArgument file is not DRM-protected.
1.614 + * @leave KErrCANoRights no rights
1.615 + * @see caferr.h
1.616 + * @see caftypes.h
1.617 + *
1.618 + * @since 3.0
1.619 + */
1.620 + IMPORT_C void GetRightsDetailsL( RFile& aFileHandle,
1.621 + TUint32 aIntent, TBool& aExpired, TBool& aSendingAllowed,
1.622 + CDRMHelperRightsConstraints*& aPlay,
1.623 + CDRMHelperRightsConstraints*& aDisplay,
1.624 + CDRMHelperRightsConstraints*& aExecute,
1.625 + CDRMHelperRightsConstraints*& aPrint );
1.626 +
1.627 +
1.628 + /**
1.629 + * Gets details of rights object associated of given file.
1.630 + *
1.631 + * @param[in] aFileName Full path to file
1.632 + * @param[in] aIntent ContentAccess::EPlay, ContentAccess::EView,
1.633 + * ContentAccess::EPrint or ContentAccess::EExecute
1.634 + * @param[out] aExpired ETrue if rights are not valid. If this is ETrue
1.635 + * and some constraints are returned, rights will become valid in future
1.636 + * @param[out] aSendingAllowed ETrue if content can be sent
1.637 + * @param[out] aPlay play constraints, must be deleted by caller
1.638 + * @param[out] aDisplay display constraints, must be deleted by caller
1.639 + * @param[out] aExecute execute constraints, must be deleted by caller
1.640 + * @param[out] aPrint print constraints, must be deleted by caller
1.641 + *
1.642 + * @leave KErrArgument file is not DRM-protected.
1.643 + * @leave KErrCANoRights no rights
1.644 + * @see caferr.h
1.645 + * @see caftypes.h
1.646 + */
1.647 + IMPORT_C void GetRightsDetailsL( const TDesC& aFileName,
1.648 + TUint32 aIntent, TBool& aExpired, TBool& aSendingAllowed,
1.649 + CDRMRightsConstraints*& aPlay,
1.650 + CDRMRightsConstraints*& aDisplay,
1.651 + CDRMRightsConstraints*& aExecute,
1.652 + CDRMRightsConstraints*& aPrint );
1.653 +
1.654 +
1.655 + /**
1.656 + * Gets details of rights object associated of given file.
1.657 + *
1.658 + * @param[in] aFileHandle file handle to the file
1.659 + * @param[in] aIntent ContentAccess::EPlay, ContentAccess::EView,
1.660 + * ContentAccess::EPrint or ContentAccess::EExecute
1.661 + * @param[out] aExpired ETrue if rights are not valid. If this is ETrue
1.662 + * and some constraints are returned, rights will become valid in future
1.663 + * @param[out] aSendingAllowed ETrue if content can be sent
1.664 + * @param[out] aPlay play constraints, must be deleted by caller
1.665 + * @param[out] aDisplay display constraints, must be deleted by caller
1.666 + * @param[out] aExecute execute constraints, must be deleted by caller
1.667 + * @param[out] aPrint print constraints, must be deleted by caller
1.668 + *
1.669 + * @leave KErrArgument file is not DRM-protected.
1.670 + * @leave KErrCANoRights no rights
1.671 + * @see caferr.h
1.672 + * @see caftypes.h
1.673 + *
1.674 + * @since 3.0
1.675 + */
1.676 + IMPORT_C void GetRightsDetailsL( RFile& aFileHandle,
1.677 + TUint32 aIntent, TBool& aExpired, TBool& aSendingAllowed,
1.678 + CDRMRightsConstraints*& aPlay,
1.679 + CDRMRightsConstraints*& aDisplay,
1.680 + CDRMRightsConstraints*& aExecute,
1.681 + CDRMRightsConstraints*& aPrint );
1.682 +
1.683 +
1.684 + /**
1.685 + * Registers given content to be used as an automated content. This
1.686 + * function is used when registering application listens expiry
1.687 + * notifications itself
1.688 + * @param aURI: content URI
1.689 + * @return System wide error code (KErrCancel if user pressed no to
1.690 + * query).
1.691 + * @since Series 60 2.6
1.692 + */
1.693 + IMPORT_C TInt SetAutomated( const TDesC8& aURI );
1.694 +
1.695 +
1.696 + /**
1.697 + * Registers given content to be used as an automated content. This
1.698 + * function is used when registering application listens expiry
1.699 + * notifications itself.
1.700 + * @param aFileName: Full path to file
1.701 + * @return System wide error code (KErrCancel if user pressed no to
1.702 + * query).
1.703 + * @since Series 60 2.6
1.704 + */
1.705 + IMPORT_C TInt SetAutomated( const TDesC& aFilename );
1.706 +
1.707 +
1.708 + /**
1.709 + * Registers given content to be used as an automated content. This
1.710 + * function is used when registering application listens expiry
1.711 + * @param aFileHandle: file handle to the file
1.712 + * @return System wide error code (KErrCancel if user pressed no to
1.713 + * query).
1.714 + * @since 3.0
1.715 + */
1.716 + IMPORT_C TInt SetAutomated( RFile& aFileHandle );
1.717 +
1.718 +
1.719 + /**
1.720 + * Displays the confirmation query about setting given content as an
1.721 + * automated content. Note that this function does not actually
1.722 + * register content, just displays the note
1.723 + * @param aURI: content URI
1.724 + * @return System wide error code (KErrCancel if user pressed no to
1.725 + * query).
1.726 + * @since Series 60 2.6
1.727 + */
1.728 + IMPORT_C TInt ShowAutomatedNote( const TDesC8& aURI );
1.729 +
1.730 +
1.731 + /**
1.732 + * Displays the confirmation query about setting given content as an
1.733 + * automated content. Note that this function does not actually
1.734 + * register content, just displays the note
1.735 + * @param aFileName: Full path to file
1.736 + * @return System wide error code (KErrCancel if user pressed no to
1.737 + * query).
1.738 + * @since Series 60 2.6
1.739 + */
1.740 + IMPORT_C TInt ShowAutomatedNote( const TDesC& aFilename );
1.741 +
1.742 +
1.743 + /**
1.744 + * Displays the confirmation query about setting given content as an
1.745 + * automated content. Note that this function does not actually
1.746 + * register content, just displays the note
1.747 + * @param aFileHandle: file handle to the file
1.748 + * @return System wide error code (KErrCancel if user pressed no to
1.749 + * query).
1.750 + * @since 3.0
1.751 + */
1.752 + IMPORT_C TInt ShowAutomatedNote( RFile& aFileHandle );
1.753 +
1.754 +
1.755 + /**
1.756 + * Registers given content to be used as an automated content. This
1.757 + * function is used when phone application listens to expiry notifications.
1.758 + * @param aURI: content URI
1.759 + * @return System wide error code (KErrCancel if user pressed no to
1.760 + * query).
1.761 + * @since Series 60 2.6
1.762 + */
1.763 + IMPORT_C TInt SetAutomatedPassive( const TDesC8& aURI );
1.764 +
1.765 +
1.766 + /**
1.767 + * Registers given content to be used as an automated content. This
1.768 + * function is used when phone application listens to expiry notifications.
1.769 + * @param aFileName: Full path to file
1.770 + * @return System wide error code (KErrCancel if user pressed no to
1.771 + * query).
1.772 + * @since Series 60 2.6
1.773 + */
1.774 + IMPORT_C TInt SetAutomatedPassive( const TDesC& aFilename );
1.775 +
1.776 +
1.777 + /**
1.778 + * Registers given content to be used as an automated content. This
1.779 + * function is used when phone application listens to expiry notifications.
1.780 + * @param aFileHandle: file handle to the file
1.781 + * @return System wide error code (KErrCancel if user pressed no to
1.782 + * query).
1.783 + * @since 3.0
1.784 + */
1.785 + IMPORT_C TInt SetAutomatedPassive( RFile& aFileHandle );
1.786 +
1.787 +
1.788 + /**
1.789 + * Registers given content to be used as an automated content without
1.790 + * confirmation query.
1.791 + * @param aURI: content URI
1.792 + * @param aActive: ETrue if registering application itself listens
1.793 + * expiry notifications
1.794 + * @return System wide error code (KErrCancel if user pressed no to
1.795 + * query).
1.796 + * @since Series 60 2.6
1.797 + */
1.798 + IMPORT_C TInt SetAutomatedSilent( const TDesC8& aURI, TBool aActive );
1.799 +
1.800 +
1.801 + /**
1.802 + * Registers given content to be used as an automated content without
1.803 + * confirmation query.
1.804 + * @param aFileName: Full path to file
1.805 + * @param aActive: ETrue if registering application itself listens
1.806 + * expiry notifications
1.807 + * @return System wide error code (KErrCancel if user pressed no to
1.808 + * query).
1.809 + * @since Series 60 2.6
1.810 + */
1.811 + IMPORT_C TInt SetAutomatedSilent( const TDesC& aFilename,
1.812 + TBool aActive );
1.813 +
1.814 +
1.815 + /**
1.816 + * Registers given content to be used as an automated content without
1.817 + * confirmation query.
1.818 + * @param aFileHandle: file handle to the file
1.819 + * @param aActive: ETrue if registering application itself listens
1.820 + * expiry notifications
1.821 + * @return System wide error code (KErrCancel if user pressed no to
1.822 + * query).
1.823 + * @since 3.0
1.824 + */
1.825 + IMPORT_C TInt SetAutomatedSilent( RFile& aFileHandle,
1.826 + TBool aActive );
1.827 +
1.828 +
1.829 + /**
1.830 + * Unregisters given content to be used as an automated content.
1.831 + * @param aURI: content URI
1.832 + * @return System wide error code.
1.833 + * @since Series 60 2.6
1.834 + */
1.835 + IMPORT_C TInt RemoveAutomated( const TDesC8& aURI );
1.836 +
1.837 +
1.838 + /**
1.839 + * Unregisters given content to be used as an automated content.
1.840 + * @param aFileName: Full path to file
1.841 + * @return System wide error code.
1.842 + * @since Series 60 2.6
1.843 + */
1.844 + IMPORT_C TInt RemoveAutomated( const TDesC& aFilename );
1.845 +
1.846 +
1.847 + /**
1.848 + * Unregisters given content to be used as an automated content.
1.849 + * @param aFileHandle: file handle to the file
1.850 + * @return System wide error code.
1.851 + * @since 3.0
1.852 + */
1.853 + IMPORT_C TInt RemoveAutomated( RFile& aFileHandle );
1.854 +
1.855 +
1.856 + /**
1.857 + * Unregisters given content to be used as an automated content.
1.858 + * This function must be used when content was registered using
1.859 + * SetAutomatedPassive.
1.860 + * @param aURI: content URI
1.861 + * @return System wide error code.
1.862 + * @since Series 60 2.6
1.863 + */
1.864 + IMPORT_C TInt RemoveAutomatedPassive( const TDesC8& aURI );
1.865 +
1.866 +
1.867 + /**
1.868 + * Unregisters given content to be used as an automated content.
1.869 + * This function must be used when content was registered using
1.870 + * SetAutomatedPassive.
1.871 + * @param aFileName: Full path to file
1.872 + * @return System wide error code.
1.873 + * @since Series 60 2.6
1.874 + */
1.875 + IMPORT_C TInt RemoveAutomatedPassive( const TDesC& aFilename );
1.876 +
1.877 +
1.878 + /**
1.879 + * Unregisters given content to be used as an automated content.
1.880 + * This function must be used when content was registered using
1.881 + * SetAutomatedPassive.
1.882 + * @param aFileHandle: file handle to the file
1.883 + * @return System wide error code.
1.884 + * @since 3.0
1.885 + */
1.886 + IMPORT_C TInt RemoveAutomatedPassive( RFile& aFileHandle );
1.887 +
1.888 +
1.889 + /**
1.890 + * Checks if given content can be set as an automated content.
1.891 + * @param aURI: content URI
1.892 + * @param aValue: ETrue if content can be set as automated.
1.893 + * @return System wide or DRM specific error code.
1.894 + * @since Series 60 2.6
1.895 + */
1.896 + IMPORT_C TInt CanSetAutomated( const TDesC8& aURI,
1.897 + TBool& aValue );
1.898 +
1.899 +
1.900 + /**
1.901 + * Checks if given content can be set as an automated content.
1.902 + * @param aFileName: Full path to file
1.903 + * @param aValue: ETrue if content can be set as automated.
1.904 + * @return System wide or DRM specific error code.
1.905 + * @since Series 60 2.6
1.906 + */
1.907 + IMPORT_C TInt CanSetAutomated( const TDesC& aFilename,
1.908 + TBool& aValue );
1.909 +
1.910 +
1.911 + /**
1.912 + * Checks if given content can be set as an automated content.
1.913 + * @param aFileHandle: file handle to the file
1.914 + * @param aValue: ETrue if content can be set as automated.
1.915 + * @return System wide or DRM specific error code.
1.916 + * @since 3.0
1.917 + */
1.918 + IMPORT_C TInt CanSetAutomated( RFile& aFileHandle,
1.919 + TBool& aValue );
1.920 +
1.921 +
1.922 + /**
1.923 + * Informs DRMHelper that idle-screen has been activated.
1.924 + * @return -
1.925 + * @since Series 60 2.6
1.926 + */
1.927 + IMPORT_C void IndicateIdle();
1.928 +
1.929 + /**
1.930 + * Handle the general UI based error notes
1.931 + * @since 3.0
1.932 + * @param aTextId The code for DRM general notification note.
1.933 + * @param aURI The DRM files URI, that caused the DRM error.
1.934 + * @return KErrnone if everything went ok, else wide scale of Symbian errors
1.935 + */
1.936 + IMPORT_C TInt ShowDRMUINotification2L( TDRMHelperNotificationID aTextId,
1.937 + const TDesC8& aURI );
1.938 +
1.939 +
1.940 + /**
1.941 + * Handle the general UI based error notes
1.942 + * @since 3.0
1.943 + * @param aTextId The code for DRM general notification note.
1.944 + * @param aFileName The DRM file's name and path, that caused the DRM error.
1.945 + * @return KErrnone if everything went ok, else wide scale of Symbian errors
1.946 + */
1.947 + IMPORT_C TInt ShowDRMUINotification2L( TDRMHelperNotificationID aTextId,
1.948 + const TDesC& aFileName );
1.949 +
1.950 +
1.951 + /**
1.952 + * Set count limit for CheckRightsAmountL
1.953 + * @param aCounts: new count limit for displaying the note.
1.954 + * @return -
1.955 + */
1.956 + IMPORT_C void SetCountLimitL( TUint aCounts );
1.957 +
1.958 +
1.959 + /**
1.960 + * Set time limit in days for CheckRightsAmountL
1.961 + * @param aDays: new time limit for displaying the note.
1.962 + * @return -
1.963 + */
1.964 + IMPORT_C void SetTimeLimitL( TUint aDays );
1.965 +
1.966 +
1.967 + /**
1.968 + * Set percentage limit for CheckRightsAmountL. Applies to both counts and time.
1.969 + * @param aPercentage: new limit for displaying the note.
1.970 + * @return -
1.971 + */
1.972 + IMPORT_C void SetPercentageLimitL( TUint aPercentage );
1.973 +
1.974 +
1.975 + /**
1.976 + * GetContentURIList
1.977 + *
1.978 + * Returns a list of all content URIs that have rights in the rights
1.979 + * database.
1.980 + *
1.981 + * @since 2.5
1.982 + * @param aURIList: Out parameter for the URI list.
1.983 + * @return Ok if the URI list could be retreived.
1.984 + */
1.985 + IMPORT_C TInt GetContentURIList(
1.986 + RPointerArray<HBufC8>*& aURIList);
1.987 +
1.988 +
1.989 + /**
1.990 + * DataTypesCount
1.991 + *
1.992 + * Returns the number of previously registered datatypes which are
1.993 + * supported by the DRM system and associated applications.
1.994 + *
1.995 + * @since 2.0
1.996 + * @param aCount: Out parameter for the datatype count
1.997 + * @return EOk if the number of datatypes has been returned correctly
1.998 + */
1.999 + IMPORT_C TInt DataTypesCount(
1.1000 + TInt& aCount);
1.1001 +
1.1002 +
1.1003 + /**
1.1004 + * SupportedDataType
1.1005 + *
1.1006 + * Returns a specific datatype which has been registered before by giving an index
1.1007 + *
1.1008 + * @since 2.0
1.1009 + * @param aIndex: Number of the datatype to return
1.1010 + * @param aDataType: Out parameter for the datatype
1.1011 + * @return EOk if the datatype was returned correctly
1.1012 + */
1.1013 + IMPORT_C TInt SupportedDataType(
1.1014 + const TInt aIndex, TDataType& aDataType);
1.1015 +
1.1016 +
1.1017 + /**
1.1018 + * RegisterDataType
1.1019 + *
1.1020 + * Registers a datatype as a supported datatype.
1.1021 + *
1.1022 + * @since 2.0
1.1023 + * @param aDataType: Datatype to register
1.1024 + * @return EOk if the datatype has been registered
1.1025 + */
1.1026 + IMPORT_C TInt RegisterDataType(
1.1027 + const TDataType& aDataType);
1.1028 +
1.1029 +
1.1030 + /**
1.1031 + * UnRegisterDataType
1.1032 + *
1.1033 + * Unregisters a datatype via its index.
1.1034 + *
1.1035 + * @since 2.5
1.1036 + * @param aIndex: Number of the datatype to unregister
1.1037 + * @return EOk if the datatype has been unregistered
1.1038 + */
1.1039 + IMPORT_C TInt UnRegisterDataType(
1.1040 + const TInt aIndex);
1.1041 +
1.1042 +
1.1043 + /**
1.1044 + * SupportedDRMMethods
1.1045 + *
1.1046 + * Returns the supported DRM protection methods and the OMA compliance
1.1047 + * level of the DRM engine
1.1048 + *
1.1049 + * @since 2.0
1.1050 + * @param aDRMMethod: Out parameter, bit mask containing any
1.1051 + * combination of EForwardLock, ECombinedDelivery,
1.1052 + * ESeparateDelivery etc.
1.1053 + * @param aOMALevel: OMA compliance of the DRM engine
1.1054 + * @return DRMCommon error code
1.1055 + */
1.1056 +
1.1057 + IMPORT_C TInt SupportedDRMMethods2(
1.1058 + TInt& aDRMMethod, TDRMHelperOMALevel& aOMALevel);
1.1059 +
1.1060 +
1.1061 + /**
1.1062 + * Consume2
1.1063 + *
1.1064 + * Overrides any rights consumption. This function must only be used by
1.1065 + * applications with user interaction and not by intermediate components.
1.1066 + * The main use cases are signalling that content is to be installed
1.1067 + * (including thumbnail generation), or that content is to be consumed.
1.1068 + * They are characterized as calls to this function with the correct
1.1069 + * intent (i.e. EPlay or EInstall) and the corresponding action (i.e.
1.1070 + * telling whether the indicated intent is started or finished).
1.1071 + * Calls to this function must be the result of a user interaction or
1.1072 + * otherwise high level event.
1.1073 + *
1.1074 + * @since 3.0
1.1075 + * @param aContentURI: URI of the content which will be consumed
1.1076 + * @param aRightsSpec: the consumption intent (EPlay, EDisplay, EPrint,
1.1077 + * EExecute or EInstall)
1.1078 + * @param anAction: the consumption action, telling whether the
1.1079 + * content consumption starts or finishes.
1.1080 + * @return EOk if consume action was successfully signalled to the engine.
1.1081 + */
1.1082 + IMPORT_C TInt Consume2(
1.1083 + const TDesC8& aContentURI,
1.1084 + TUint32 aRightsSpec,
1.1085 + TDRMHelperConsumeAction anAction);
1.1086 +
1.1087 +
1.1088 + /**
1.1089 + * ConsumeFile2
1.1090 + *
1.1091 + * Overrides any rights consumption. This function must only be used by
1.1092 + * applications with user interaction and not by intermediate components.
1.1093 + * The main use cases are signalling that content is to be installed
1.1094 + * (including thumbnail generation), or that content is to be consumed.
1.1095 + * They are characterized as calls to this function with the correct
1.1096 + * intent (i.e. EPlay or EInstall) and the corresponding action (i.e.
1.1097 + * telling whether the indicated intent is started or finished).
1.1098 + * Calls to this function must be the result of a user interaction or
1.1099 + * otherwise high level event.
1.1100 + *
1.1101 + * @since 3.0
1.1102 + * @param
1.1103 + * @param aRightsSpec: the consumption intent (EPlay, EDisplay, EPrint,
1.1104 + * EExecute or EInstall)
1.1105 + * @param anAction: the consumption action, telling whether the
1.1106 + * content consumption starts or finishes.
1.1107 + * @return EOk if consume action was successfully signalled to the engine.
1.1108 + */
1.1109 + IMPORT_C TInt ConsumeFile2(
1.1110 + const TDesC& aFileName,
1.1111 + TUint32 aRightsSpec,
1.1112 + TDRMHelperConsumeAction anAction);
1.1113 +
1.1114 +
1.1115 + /**
1.1116 + * ConsumeFile2
1.1117 + *
1.1118 + * Overrides any rights consumption. This function must only be used by
1.1119 + * applications with user interaction and not by intermediate components.
1.1120 + * The main use cases are signalling that content is to be installed
1.1121 + * (including thumbnail generation), or that content is to be consumed.
1.1122 + * They are characterized as calls to this function with the correct
1.1123 + * intent (i.e. EPlay or EInstall) and the corresponding action (i.e.
1.1124 + * telling whether the indicated intent is started or finished).
1.1125 + * Calls to this function must be the result of a user interaction or
1.1126 + * otherwise high level event.
1.1127 + *
1.1128 + * @since 3.0
1.1129 + * @param aFileHandle: file handle to the file
1.1130 + * @param aRightsSpec: the consumption intent (EPlay, EDisplay, EPrint,
1.1131 + * EExecute or EInstall)
1.1132 + * @param anAction: the consumption action, telling whether the
1.1133 + * content consumption starts or finishes.
1.1134 + * @return EOk if consume action was successfully signalled to the engine.
1.1135 + */
1.1136 + IMPORT_C TInt ConsumeFile2(
1.1137 + RFile& aFileHandle,
1.1138 + TUint32 aRightsSpec,
1.1139 + TDRMHelperConsumeAction anAction);
1.1140 +
1.1141 + /**
1.1142 + * Acquires rights for given content if rights have been expired or rights are missing.
1.1143 + * If content already has valid or future rights, does nothing.
1.1144 + * This function should be called when user selects activate from options menu.
1.1145 + * Leaves with system-wide error code in case of error.
1.1146 + * @param aContent: Content object
1.1147 + */
1.1148 + IMPORT_C void ActivateContentL(CData& aContent);
1.1149 +
1.1150 + /**
1.1151 + * Acquires rights for given content if rights have been expired or rights are missing.
1.1152 + * If content already has valid or future rights, does nothing.
1.1153 + * This function should be called when user selects activate from options menu.
1.1154 + * Leaves with system-wide error code in case of error.
1.1155 + * @param aFileName: Full path to file
1.1156 + */
1.1157 + IMPORT_C void ActivateContentL(TDesC& aFileName);
1.1158 +
1.1159 + /**
1.1160 + * Checks if given content has embedded preview or if it is possible to get preview rights for it.
1.1161 + * Leaves with system-wide error code in case of error.
1.1162 + * @param aContent: Content object
1.1163 + * @param aPreviewUri: Out: URI of the embedded preview or PreviewRights URL. Must be freed by caller
1.1164 + * @return preview type
1.1165 + */
1.1166 + IMPORT_C TDRMHelperPreviewType HasPreviewL(CData& aContent, HBufC8*& aPreviewUri);
1.1167 +
1.1168 + /**
1.1169 + * Checks if given content has embedded preview or if it is possible to get preview rights for it.
1.1170 + * Leaves with system-wide error code in case of error.
1.1171 + * @param aFileName: Full path to file.
1.1172 + * @param aPreviewUri: Out: URI of the embedded preview or PreviewRights URL. Must be freed by caller
1.1173 + * @return preview type
1.1174 + */
1.1175 + IMPORT_C TDRMHelperPreviewType HasPreviewL(TDesC& aFileName, HBufC8*& aPreviewUri);
1.1176 +
1.1177 + /**
1.1178 + * Acquires preview rights for given content.
1.1179 + * Leaves with system-wide error code in case of error.
1.1180 + * @param aContent: Content object
1.1181 + */
1.1182 + IMPORT_C void GetPreviewRightsL(CData& aContent);
1.1183 +
1.1184 + /**
1.1185 + * Acquires preview rights for given content.
1.1186 + * Leaves with system-wide error code in case of error.
1.1187 + * @param aFileName: Full path to file.
1.1188 + */
1.1189 + IMPORT_C void GetPreviewRightsL(TDesC& aFileName);
1.1190 +
1.1191 + /**
1.1192 + * This method should be called after embedded preview has been played.
1.1193 + * It asks from user if he/she wants to buy rights and acquires those if user agrees.
1.1194 + * Leaves with system-wide error code in case of error.
1.1195 + * @param aContent: Content object.
1.1196 + * @return ETrue if user selects to buy rights.
1.1197 + */
1.1198 + IMPORT_C TBool EmbeddedPreviewCompletedL(CData& aContent);
1.1199 +
1.1200 + /**
1.1201 + * This method should be called after embedded preview has been played.
1.1202 + * It asks from user if he/she wants to buy rights and acquires those if user agrees.
1.1203 + * Leaves with system-wide error code in case of error.
1.1204 + * @param aFileName: Full path to file.
1.1205 + * @return ETrue if user selects to buy rights.
1.1206 + */
1.1207 + IMPORT_C TBool EmbeddedPreviewCompletedL(TDesC& aFileName);
1.1208 +
1.1209 + /**
1.1210 + * Checks if given content has InfoUrl.
1.1211 + * Leaves with system-wide error code in case of error.
1.1212 + * @param aContent: Content object.
1.1213 + * @param aInfoUrl: Out: InfoUrl. Must be freed by caller.
1.1214 + * @return ETrue if content has InfoUrl.
1.1215 + */
1.1216 + IMPORT_C TBool HasInfoUrlL(CData& aContent, HBufC8*& aInfoUrl);
1.1217 +
1.1218 + /**
1.1219 + * Checks if given content has InfoUrl.
1.1220 + * Leaves with system-wide error code in case of error.
1.1221 + * @param aFileName: Full path to file.
1.1222 + * @param aInfoUrl: Out: InfoUrl. Must be freed by caller.
1.1223 + * @return ETrue if content has InfoUrl.
1.1224 + */
1.1225 + IMPORT_C TBool HasInfoUrlL(TDesC& aFileName, HBufC8*& aInfoUrl);
1.1226 +
1.1227 + /**
1.1228 + * Opens browser with InfoUrl of the content.
1.1229 + * Leaves with system-wide error code in case of error.
1.1230 + * @param aContent: Content object.
1.1231 + */
1.1232 + IMPORT_C void OpenInfoUrlL(CData& aContent);
1.1233 +
1.1234 + /**
1.1235 + * Opens browser with InfoUrl of the content.
1.1236 + * Leaves with system-wide error code in case of error.
1.1237 + * @param aFileName: Full path to file.
1.1238 + */
1.1239 + IMPORT_C void OpenInfoUrlL(TDesC& aFileName);
1.1240 +
1.1241 + /**
1.1242 + * Sets the type of automated content to be registered. This method
1.1243 + * should be called before calling any of SetAutomated* methods.
1.1244 + * @param aAutomatedType: type of automated content
1.1245 + * @return System wide error code
1.1246 + * @since Series 60 3.0
1.1247 + */
1.1248 + IMPORT_C TInt SetAutomatedType( TDRMHelperAutomatedType aAutomatedType );
1.1249 +
1.1250 + /**
1.1251 + * Sets media type of content for preview. Should be called prior to
1.1252 + * calling HandleErrorOrPreviewL or EmbeddedPreviewCompletedL.
1.1253 + * @param aMediaType: media type of content.
1.1254 + * @return System wide error code
1.1255 + * @since S60 3.1u
1.1256 + */
1.1257 + IMPORT_C TInt SetPreviewMediaType(
1.1258 + TDRMHelperPreviewMediaType aMediaType );
1.1259 +
1.1260 + protected: // New functions
1.1261 +
1.1262 + /**
1.1263 + * ?member_description.
1.1264 + * @since ?Series60_version
1.1265 + * @param ?arg1 ?description
1.1266 + * @return ?description
1.1267 + */
1.1268 + //?type ?member_function( ?type ?arg1 );
1.1269 +
1.1270 + protected: // Functions from base classes
1.1271 +
1.1272 + /**
1.1273 + * From ?base_class ?member_description
1.1274 + */
1.1275 + //?type ?member_function();
1.1276 +
1.1277 +
1.1278 + private:
1.1279 +
1.1280 + /**
1.1281 + * C++ default constructor.
1.1282 + */
1.1283 + CDRMHelper( CCoeEnv& aCoeEnv );
1.1284 + CDRMHelper();
1.1285 +
1.1286 + /**
1.1287 + * By default Symbian 2nd phase constructor is private.
1.1288 + */
1.1289 + void ConstructL( RFs* aFs );
1.1290 +
1.1291 + // Prohibit copy constructor if not deriving from CBase.
1.1292 + // ?classname( const ?classname& );
1.1293 + // Prohibit assigment operator if not deriving from CBase.
1.1294 + // ?classname& operator=( const ?classname& );
1.1295 +
1.1296 + /**
1.1297 + * Display query dialog
1.1298 + */
1.1299 + TInt DisplayQueryWithIdL( TInt aTextResourceId, TInt aQueryResourceId );
1.1300 + TInt DisplayQueryWithIdValueL( TInt aTextResourceId, TInt aQueryResourceId,
1.1301 + const TDesC& aString );
1.1302 + TInt DisplayQueryL( TInt aTextResourceId, TInt aValue );
1.1303 + TInt DisplayQueryL( TInt aTextResourceId, const TDesC& aString );
1.1304 + TInt DisplayQueryL(
1.1305 + TInt aTextResourceId,
1.1306 + const TDesC& aString,
1.1307 + TInt aValue,
1.1308 + TInt aStringPos = -1,
1.1309 + TInt aValuePos = -1 );
1.1310 + TInt DisplayQueryL( TDesC& aPromptText, TInt aQueryResourceId );
1.1311 +
1.1312 + /**
1.1313 + * Display information note
1.1314 + */
1.1315 + void DisplayInfoNoteL( TInt aTextResourceId );
1.1316 + void DisplayInfoNoteL( TInt aTextResourceId, const TDesC& aString );
1.1317 + void DisplayInfoNoteL( TInt aTextResourceId, TInt aValue );
1.1318 + void DisplayInfoNoteL( TDesC& aPromptText, TInt aResourceId,
1.1319 + const TDesC& aString = KNullDesC, TInt aValue = -1 );
1.1320 +
1.1321 + /**
1.1322 + * Launch browser embedded
1.1323 + */
1.1324 + void LaunchBrowserL( HBufC8* aUrl );
1.1325 + void LaunchBrowserL( HBufC* aUrl );
1.1326 +
1.1327 + /**
1.1328 + * Get rights-issuer URI from DCF file
1.1329 + */
1.1330 + void GetRightsIssuerL( const CData& aContent, HBufC*& aIssuer );
1.1331 +
1.1332 + /**
1.1333 + * Get time and count based constraints
1.1334 + */
1.1335 + TInt GetCounts( CDRMRightsConstraints* aConstraint,
1.1336 + TUint32& aOriginalCount, TTimeIntervalDays& aDuration );
1.1337 +
1.1338 + TInt GetCounts( CDRMRightsConstraints* aConstraint,
1.1339 + TUint32& aCountLeft, TTime& aEndTime );
1.1340 +
1.1341 + TInt GetCounts( CDRMConstraint* aConstraint,
1.1342 + TUint32& aOriginalCount, TTimeIntervalDays& aDuration );
1.1343 +
1.1344 + TInt GetCounts( CDRMConstraint* aConstraint,
1.1345 + TUint32& aCountLeft, TTime& aEndTime );
1.1346 +
1.1347 + /**
1.1348 + * Launch rights manager UI
1.1349 + */
1.1350 + void LaunchRightsManagerUiL( const TDesC& aParam16 );
1.1351 +
1.1352 + /**
1.1353 + * Form string needed to launch rights manager UI embedded.
1.1354 + */
1.1355 + void CreateLaunchParamL( TUint32 aLocalId, const HBufC8* aUrl,
1.1356 + HBufC*& aLaunchParam );
1.1357 +
1.1358 + /**
1.1359 + * Strip path and extension from given filename.
1.1360 + * Caller is responsible for freeing returned buffer
1.1361 + */
1.1362 + TPtrC StripPathAndExtension( const TDesC& aFileName );
1.1363 +
1.1364 + /**
1.1365 + * Get expiration details of file.
1.1366 + * Returns DRMCommon::ENoRights if no rights object found or
1.1367 + * CDRMRights::TExpiration value
1.1368 + */
1.1369 + TInt GetExpirationDetails( HBufC8* aContentUri, TInt aIntent,
1.1370 + CDRMRights*& aRightsObject );
1.1371 +
1.1372 + /**
1.1373 + * Get expiration time of given rights object
1.1374 + */
1.1375 + TInt CalculateEndTime( CDRMRights* aRights, TInt aIntent,
1.1376 + TTime& aEndTime, TBool& aInactive );
1.1377 +
1.1378 + /**
1.1379 + * Get end time of given constraint
1.1380 + */
1.1381 + TInt GetEndTime( CDRMRightsConstraints* aConstraint,
1.1382 + TTime& aEndTime, TBool& aInactive );
1.1383 +
1.1384 + /**
1.1385 + * Register content as automated
1.1386 + */
1.1387 + TInt PerformSetAutomatedL( const CData& aContent, TBool aActive );
1.1388 + TInt DoSetAutomatedL( const TDesC8& aURI, TBool aActive,
1.1389 + const HBufC* aMimeType );
1.1390 +
1.1391 + /**
1.1392 + * Display confirmation query about setting as automated. Does not
1.1393 + * actually register.
1.1394 + */
1.1395 + TInt PerformShowAutomatedNoteL( const CData& aContent );
1.1396 + TInt DoShowAutomatedNoteL( const TDesC8& aURI,
1.1397 + const HBufC* aMimeType );
1.1398 +
1.1399 + /**
1.1400 + * Register content as automated without showing any queries
1.1401 + */
1.1402 + TInt PerformSetAutomatedSilentL( const CData& aContent, TBool aActive );
1.1403 + TInt DoSetAutomatedSilent( const TDesC8& aURI, TBool aActive, TInt aIntent );
1.1404 +
1.1405 + /**
1.1406 + * Returns default intent for the mimetype
1.1407 + */
1.1408 + TInt Intent( const HBufC* aMimeType );
1.1409 +
1.1410 + /**
1.1411 + * Checks if content can be used as automated content
1.1412 + */
1.1413 + TInt PerformCanSetAutomatedL( const CData& aContent,TBool& aValue );
1.1414 + TInt DoCanSetAutomated( const TDesC8& aURI, const HBufC* aMimeType,
1.1415 + TBool& aValue );
1.1416 + TBool DoCheckSkinCanSetAutomated(CDRMRights* aRights);
1.1417 +
1.1418 + /**
1.1419 + * Gets mimetype based on content URI
1.1420 + */
1.1421 + HBufC* MimeTypeFromURIL( const TDesC8& aURI );
1.1422 +
1.1423 + /**
1.1424 + * Gets corresponding filename (including full path) based on content
1.1425 + * URI
1.1426 + */
1.1427 + TInt GetFileHandleFromURIL( const TDesC8& aURI, RFile& aFileHandle );
1.1428 +
1.1429 + /**
1.1430 + * Get start time of given rights object
1.1431 + */
1.1432 + TInt GetStartTime( CDRMRights* aRights, TInt aIntent,
1.1433 + TTime& aStartTime );
1.1434 +
1.1435 + /**
1.1436 + * Displays info note of rights that are not yet valid
1.1437 + */
1.1438 + TInt ShowFutureNoteL( const HBufC* aMimeType, CDRMRights* aRightsObject );
1.1439 +
1.1440 + /**
1.1441 + * Handles error by displaying appropriate note to user.
1.1442 + */
1.1443 + TInt DoHandleErrorL( TInt aError, HBufC8* aContentUri, HBufC* aMimeType,
1.1444 + HBufC* aRIUrl, HBufC* aDomainRoUrl, HBufC* aEta, HBufC8* aRiId8,
1.1445 + HBufC8* aDomainId8, const TDesC& aFileName );
1.1446 +
1.1447 + /**
1.1448 + * Checks if rights are about to expire.
1.1449 + */
1.1450 + TInt DoCheckRightsPercentL( HBufC8* aContentUri, HBufC* aMimeType,
1.1451 + HBufC* aRIUrl, const TDesC& aFileName, TInt aThreshold );
1.1452 +
1.1453 + TInt DoCheckRightsAmountL( HBufC8* aContentUri, HBufC* aMimeType,
1.1454 + HBufC* aRIUrl, const TDesC& aFileName, TInt aCount, TInt aDays );
1.1455 +
1.1456 + /**
1.1457 + * Gets rights details.
1.1458 + */
1.1459 + void DoGetRightsDetailsL( HBufC8* aContentUri, TUint32 aIntent,
1.1460 + TBool& aExpired, CDRMHelperRightsConstraints*& aPlay,
1.1461 + CDRMHelperRightsConstraints*& aDisplay,
1.1462 + CDRMHelperRightsConstraints*& aExecute,
1.1463 + CDRMHelperRightsConstraints*& aPrint );
1.1464 +
1.1465 + void DoGetRightsDetailsL( CData* aContent, TUint32 aIntent,
1.1466 + TBool& aExpired, TBool& aSendingAllowed, CDRMRightsConstraints*& aPlay,
1.1467 + CDRMRightsConstraints*& aDisplay,
1.1468 + CDRMRightsConstraints*& aExecute,
1.1469 + CDRMRightsConstraints*& aPrint );
1.1470 +
1.1471 + /**
1.1472 + * Get constraints for given rights
1.1473 + */
1.1474 + void GetConstraintsL(
1.1475 + CDRMRights& aRights,
1.1476 + CDRMHelperRightsConstraints*& aPlay,
1.1477 + CDRMHelperRightsConstraints*& aDisplay,
1.1478 + CDRMHelperRightsConstraints*& aExecute,
1.1479 + CDRMHelperRightsConstraints*& aPrint );
1.1480 +
1.1481 + /**
1.1482 + * Unregisters automated content.
1.1483 + */
1.1484 + TInt PerformRemoveAutomatedL( const CData& aContent, TBool aActive );
1.1485 +
1.1486 + void HandleServerAppExit(TInt aReason);
1.1487 +
1.1488 + void CheckPreviewUriL(
1.1489 + const CData* aContent,
1.1490 + HBufC*& aEmbeddedPreviewUri,
1.1491 + TInt& aPreviewType );
1.1492 +
1.1493 + TInt DisplayPopupWindowsForPreviewL(TInt aPreviewType);
1.1494 +
1.1495 + /**
1.1496 + * Returns correct resource id for automated content notes.
1.1497 + * If aExpired is ETrue, aSecondParameter indicates if RI URL exists
1.1498 + * If aExpired is EFalse, aSecondParameter indicates if there is one day left
1.1499 + * aRejectReason tells the constraints which are invalid.
1.1500 + */
1.1501 + TInt AutomatedResIdL( TBool aExpired, TBool aSecondParameter, TUint32 aRejectReason );
1.1502 +
1.1503 + /**
1.1504 + * Returns the correct resource id for expired and no rights notes
1.1505 + */
1.1506 + TInt ErrorResIdL( const TDesC8& aContentUri, TInt aIntent,
1.1507 + TBool aRightsIssuer, TBool aExpired );
1.1508 +
1.1509 + /**
1.1510 + * Returns the constraints which are invalid
1.1511 + */
1.1512 + TUint32 RejectReasonL( TInt aIntent, const TDesC8& aContentUri );
1.1513 +
1.1514 + /**
1.1515 + * Prepares secondary display for DRM notes
1.1516 + */
1.1517 + void PrepareSecondaryDisplayL( CEikDialog& aDialog, TInt aResourceId,
1.1518 + const TDesC& aString = KNullDesC, TInt aValue = -1 );
1.1519 +
1.1520 + /**
1.1521 + * Cancels secondary display for DRM notes
1.1522 + */
1.1523 + void CancelSecondaryDisplayL( TInt aResourceId );
1.1524 +
1.1525 + /**
1.1526 + * Check whether a file as a silent rights URL which can be used, i.e the URL is valid
1.1527 + * and on the white list.
1.1528 + */
1.1529 + HBufC8* HasSilentRightsUrlL( CData* aContent );
1.1530 +
1.1531 + /**
1.1532 + * Get rights silently
1.1533 + */
1.1534 + TInt GetSilentRightsL( const TDesC8& aUrl );
1.1535 +
1.1536 + /**
1.1537 + * Check if the user has allowed silent rights
1.1538 + */
1.1539 + TBool SilentRightsAllowedL();
1.1540 +
1.1541 + /**
1.1542 + * Check if browser AP has been defined
1.1543 + */
1.1544 + TBool BrowserAPDefinedL();
1.1545 +
1.1546 + protected: // Data
1.1547 + // ?one_line_short_description_of_data
1.1548 + //?data_declaration;
1.1549 +
1.1550 + private: // Data
1.1551 + CCoeEnv* iCoeEnv;
1.1552 +
1.1553 + // DRM engine
1.1554 + DRMCommon* iDRMCommon;
1.1555 +
1.1556 + // used to make launching rights manager ui synchronous
1.1557 + CActiveSchedulerWait iWait;
1.1558 +
1.1559 + RDRMHelper iHelperServer;
1.1560 +
1.1561 + // is CoeEnv used
1.1562 + TBool iUseCoeEnv;
1.1563 +
1.1564 + // Used to read resources when CoeEnv is not available
1.1565 + CStringResourceReader* iStringResourceReader;
1.1566 +
1.1567 + TBool iOma2;
1.1568 +
1.1569 + RPointerArray<CConsumeData> iConsumeList;
1.1570 +
1.1571 + TInt iAutomatedType;
1.1572 +
1.1573 + RFs iFs;
1.1574 +
1.1575 + TBool iFsOwned;
1.1576 +
1.1577 + TInt iPreviewMediaType;
1.1578 +
1.1579 + // Used to queue up global notes
1.1580 + RPointerArray<CDRMHelperInfoNoteWrapper> iNoteList;
1.1581 +
1.1582 + CSchemeHandler* iSchemeHandler;
1.1583 +
1.1584 + TBool iReturnCancel;
1.1585 +
1.1586 + // Used to send cancel events to cover ui
1.1587 + CMediatorEventProvider* iEventProvider;
1.1588 +
1.1589 + public: // Friend classes
1.1590 + protected: // Friend classes
1.1591 + private: // Friend classes
1.1592 +
1.1593 + };
1.1594 +
1.1595 +#endif // __DRMHELPER_H__
1.1596 +
1.1597 +// End of File
1.1598 +