|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Observer interface for CheckRightsAmount |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MDRMUICHECKRIGHTSOBSERVER_H |
|
20 #define MDRMUICHECKRIGHTSOBSERVER_H |
|
21 |
|
22 #include <drmhandleerrorobserver.h> |
|
23 #include <drmutilitytypes.h> |
|
24 |
|
25 namespace DRM |
|
26 { |
|
27 |
|
28 /** |
|
29 * An interface containing callbacks for CDrmUiHandling::CheckRightsAmount() |
|
30 * |
|
31 * By implementing these methods observer can get more information about |
|
32 * what kind of rights content has and can also override the default |
|
33 * behaviour. |
|
34 * |
|
35 * @code |
|
36 * #include <DrmUiHandling.h> |
|
37 * #include <DrmUiCheckRightsObserver.h> |
|
38 * |
|
39 * using namespace DRM; |
|
40 * |
|
41 * // Call NewLC() to create an instance of CDrmUiHandling. |
|
42 * CDrmUiHandling* drmUiHandler = CDrmUiHandling::NewLC(); |
|
43 * |
|
44 * // Handling the error got when tried to read the file |
|
45 * drmHandlerError = drmUiHandler->CheckRightsAmountL( file, this ); |
|
46 * |
|
47 * // delete the created instance of CDrmUiHandling |
|
48 * CleanupStack::PopAndDestroy( drmUiHandler ); |
|
49 * |
|
50 * ... |
|
51 * |
|
52 * // implement callbacks |
|
53 * TCheckRightsAction CMyClass::RightsLeft( TInt aDays, TInt aCounts, TInt aAccumulatedMinutes ) |
|
54 * { |
|
55 * return ECheckRightsActionDefault; |
|
56 * } |
|
57 * |
|
58 * TCheckRightsAction CMyClass::RightsNotValid( TCheckRightsStatus aRightsStatus ) |
|
59 * { |
|
60 * return ECheckRightsActionDefault; |
|
61 * } |
|
62 * |
|
63 * @endcode |
|
64 * |
|
65 * @since S60 V5.0 |
|
66 * @see CDrmUiHandling::CheckRightsAmount |
|
67 */ |
|
68 class MDrmUiCheckRightsObserver : public MDrmHandleErrorObserver |
|
69 { |
|
70 |
|
71 public: |
|
72 |
|
73 /** |
|
74 * Tells how much rights are left |
|
75 * |
|
76 * @since S60 v5.0 |
|
77 * @param[in] aOperationId Identifier of the asynchronous operation |
|
78 * which was returned when the asynchronous |
|
79 * operation was initiated, Zero(0) if it |
|
80 * is a call back from a synchronous |
|
81 * operation |
|
82 * @param[in] aUnconstrained ETrue, if the content either has no |
|
83 * constraints or if the content is only |
|
84 * for example start time based. Or the |
|
85 * time left is so long that it does not |
|
86 * fit to the aTime parameter's |
|
87 * TTimeIntervalSeconds otherwise EFalse. |
|
88 * |
|
89 * This parameter needs to always be |
|
90 * checked first, if the value is ETrue |
|
91 * the other parameters: aTime, aCounts and |
|
92 * aAccumulated should be ignored. |
|
93 * |
|
94 * @param[in] aTime Time left in seconds. Zero(0) if |
|
95 * the content does not have count |
|
96 * constraint |
|
97 * @param[in] aCounts Counts left. Zero(0) if content |
|
98 * does not have count constraint. |
|
99 * @param[in] aAccumulated Accumulated time left in seconds. |
|
100 * Zero(0) if content does not have |
|
101 * accumulated time constraint. |
|
102 * |
|
103 * @return ECheckRightsActionDefault DRM Utility performs the default |
|
104 * handling which is the handling specified in the S60 UI |
|
105 * specification |
|
106 * ECheckRightsActionOpenDetailsView Details view is opened, |
|
107 * no notes shown by DRM Utility |
|
108 * ECheckRightsActionAcquireNewRights New rights are acquired, |
|
109 * no notes shown by DRM Utility |
|
110 * ECheckRightsActionIgnore DRM Utility does not do anything |
|
111 */ |
|
112 virtual TCheckRightsAction RightsLeft( |
|
113 TInt aOperationId, |
|
114 TBool aUnconstrained, |
|
115 TTimeIntervalSeconds aTime, |
|
116 TInt aCounts, |
|
117 TTimeIntervalSeconds aAccumulated ) = 0; |
|
118 |
|
119 /** |
|
120 * Called if there are no valid rights. |
|
121 * |
|
122 * @since S60 v5.0 |
|
123 * @param[in] aOperationId Identifier of the asynchronous operation |
|
124 * which was returned when the asynchronous |
|
125 * operation was initiated, Zero(0) if it |
|
126 * is a call back from a synchronous |
|
127 * operation |
|
128 * @parem[in] aRightsStatus The reason why rights are invalid |
|
129 * @param[in] aReason Rejection reason, a bitvector which |
|
130 * states for what reasons rights have |
|
131 * been rejected from use using |
|
132 * TRejectionType |
|
133 * |
|
134 * @return ECheckRightsActionDefault DRM Utility performs the default |
|
135 * handling which is the handling specified by the S60 UI |
|
136 * specification |
|
137 * ECheckRightsActionOpenDetailsView Details view is opened, |
|
138 * no notes shown by DRM Utility |
|
139 * ECheckRightsActionAcquireNewRights New rights are acquired, |
|
140 * no notes shown by DRM Utility |
|
141 * ECheckRightsActionIgnore DRM Utility does not do anything |
|
142 */ |
|
143 virtual TCheckRightsAction RightsNotValid( |
|
144 TInt aOperationId, |
|
145 TCheckRightsStatus aRightsStatus, |
|
146 TInt aReason ) = 0; |
|
147 |
|
148 protected: |
|
149 |
|
150 }; |
|
151 |
|
152 } |
|
153 |
|
154 #endif // MDRMUICHECKRIGHTSOBSERVER_H |