|
1 /* |
|
2 * Copyright (c) 2003 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: Definition of common utilities functions |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef DRMCOMMONUTILITIES_H |
|
20 #define DRMCOMMONUTILITIES_H |
|
21 |
|
22 |
|
23 #include <e32std.h> |
|
24 #include <coemain.h> |
|
25 #include <DRMRights.h> |
|
26 #include <DRMCommon.h> |
|
27 |
|
28 class CDRMRightsMgrAppUi; |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 const TInt KUrlMaxLen( 1024 ); |
|
33 |
|
34 const TInt KMSKControlID( 3 ); |
|
35 |
|
36 // Started operation |
|
37 enum TOperation |
|
38 { |
|
39 EDRMRefreshingOnlyForDetails // Refreshing when starting DRMUI embedded |
|
40 }; |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * DRMCommonUtilities |
|
46 * |
|
47 * Collection of common utilities |
|
48 */ |
|
49 class DRMCommonUtilities |
|
50 { |
|
51 private: |
|
52 /** |
|
53 * Shows a confirmation note |
|
54 * @param aPrompt Prompt to be shown in the note |
|
55 */ |
|
56 static void ShowConfirmationNoteL( const TDesC& aPrompt ); |
|
57 |
|
58 /** |
|
59 * Shows a confirmation query |
|
60 * @param aPrompt Prompt to be shown in the query |
|
61 * @return ETrue if the query was accepted |
|
62 */ |
|
63 static TBool ShowConfirmationQueryL( const TDesC& aPrompt ); |
|
64 |
|
65 public: |
|
66 /** |
|
67 * Shows a confirmation query |
|
68 * @param aResourceId The numeric ID of the resource string to be read. |
|
69 * @param aString Reference to the replacing string. |
|
70 * @param aLoaderEnv Pointer to the control environment. |
|
71 * @return ETrue if the query was accepted |
|
72 */ |
|
73 static TBool ShowConfirmationQueryL( const TInt aResourceId, |
|
74 const TDesC& aString, |
|
75 CCoeEnv* aLoaderEnv ); |
|
76 |
|
77 /** |
|
78 * Shows a confirmation query |
|
79 * @param aResourceId The numeric ID of the resource string to be read. |
|
80 * @param aLoaderEnv Pointer to the control environment. |
|
81 * @return ETrue if the query was accepted |
|
82 */ |
|
83 static TBool ShowConfirmationQueryL( const TInt aResourceId, |
|
84 CCoeEnv* aLoaderEnv ); |
|
85 |
|
86 /** |
|
87 * Shows a confirmation note |
|
88 * @param aResourceId The numeric ID of the resource string to be read. |
|
89 * @param aString Reference to the replacing string. |
|
90 * @param aLoaderEnv Pointer to the control environment. |
|
91 */ |
|
92 static void ShowConfirmationNoteL( const TInt aResourceId, |
|
93 const TDesC& aString, |
|
94 CCoeEnv* aLoaderEnv ); |
|
95 |
|
96 /** |
|
97 * Shows a confirmation note |
|
98 * @param aResourceId The numeric ID of the resource string to be read. |
|
99 * @param aLoaderEnv Pointer to the control environment. |
|
100 */ |
|
101 static void ShowConfirmationNoteL( const TInt aResourceId, |
|
102 CCoeEnv* aLoaderEnv ); |
|
103 |
|
104 /** |
|
105 * Shows information note |
|
106 * @param aResourceId The numeric ID of the resource string to be read. |
|
107 * @param aLoaderEnv Pointer to the control environment. |
|
108 */ |
|
109 static void ShowInformationNoteL( const TInt aResourceId, |
|
110 CCoeEnv* aLoaderEnv ); |
|
111 |
|
112 /** |
|
113 * Gets the activation time for an object that will be activated in the |
|
114 * future |
|
115 * @param aRights The RO to be parsed |
|
116 * @return The future activation time |
|
117 */ |
|
118 static TTime GetFutureActivationTime( CDRMRights& aRights ); |
|
119 |
|
120 /** |
|
121 * Gets the path name where the icons reside |
|
122 * @param aIconsFileName The pathname. |
|
123 */ |
|
124 static void GetIconsFileName( TDes& aIconsFileName ); |
|
125 |
|
126 /** |
|
127 * Tells if the MO is located in a private folder |
|
128 * @param aContentPath The full name of the MO |
|
129 * @return ETrue if the MO is located in a private folder |
|
130 */ |
|
131 static TBool IsInPrivateFolderL( const TDesC& aContentPath ); |
|
132 |
|
133 /** |
|
134 * Tells if the active view is a list view |
|
135 * @param aViewId The Id of the active view |
|
136 * @return ETrue if the active view is a list view |
|
137 */ |
|
138 static TBool IsListView( const TUid& aViewId ); |
|
139 |
|
140 /** |
|
141 * Gets the URL of the issuer of the rights |
|
142 * @param aDRMCommon Pointer to the current instance of |
|
143 * DRMCommon |
|
144 * @param aFileName The full name of the MO |
|
145 * @param aRightsIssuerURL In output it contains the URL of the issuer |
|
146 * of the rights |
|
147 * @return Error code. |
|
148 */ |
|
149 static TInt RightsIssuerUrlL( const TFileName& aFileName, |
|
150 HBufC*& aRightsIssuerURL ); |
|
151 |
|
152 /** |
|
153 * Gets the status of the rights: valid, expired, or future |
|
154 * @param aRights The rights to be parsed |
|
155 * @param aExpir Status of rights |
|
156 * @return Error code |
|
157 */ |
|
158 static TInt GetRightsStatus( CDRMRights& aRights, |
|
159 CDRMRights::TExpiration& aExpir); |
|
160 |
|
161 /** |
|
162 * Parse the parameters used to load the DRMUI and starts the UI |
|
163 * directly on Details View. |
|
164 * @param aLex The parameters used to load the DRMUI (embedded |
|
165 * or not) |
|
166 * @param aStartEmbedded ETrue if DRMUI was launched embedded |
|
167 * @param aAppUi Pointer to the application Ui |
|
168 */ |
|
169 static void ParseParametersAndStartL( TLex aLex, TBool aStartEmbedded, |
|
170 CDRMRightsMgrAppUi& aAppUi ); |
|
171 |
|
172 /** |
|
173 * Separates beginning of file path and rest of path + filename |
|
174 * e.g.for localization purposes |
|
175 * @param aFileName File name with full path |
|
176 * @param aRestOfName End part of file name string |
|
177 * @return Beginning part of file path if found, otherwise KNullDesc |
|
178 */ |
|
179 static TPtrC SplitPath( const TDesC& aFileName, |
|
180 TPtrC& aRestOfName ); |
|
181 |
|
182 }; |
|
183 |
|
184 |
|
185 #endif |
|
186 |
|
187 // End of File |