72
|
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: View for DRMSettinsPlugin
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <coeaui.h>
|
|
21 |
#include <hlplch.h> // For HlpLauncher
|
|
22 |
#include <bautils.h>
|
|
23 |
#include <eikfrlbd.h>
|
|
24 |
#include <featmgr.h>
|
|
25 |
#include <StringLoader.h>
|
|
26 |
#include <aknViewAppUi.h>
|
|
27 |
#include <aknradiobuttonsettingpage.h>
|
|
28 |
#include <gsfwviewuids.h>
|
|
29 |
#include <gsprivatepluginproviderids.h>
|
|
30 |
#include <gscommon.hrh>
|
|
31 |
#include <drmsettingspluginrsc.rsg>
|
|
32 |
|
|
33 |
#include "drmsettingsplugin.h"
|
|
34 |
#include "drmsettingsplugincontainer.h"
|
|
35 |
#include "drmsettingsplugin.hrh"
|
|
36 |
#include "drmsettingsmodel.h"
|
|
37 |
#include "drmsettingsusagecheckbox.h"
|
|
38 |
#include "drmsettingsusagelist.h"
|
|
39 |
#include "wmdrmpkclientwrapper.h"
|
|
40 |
|
|
41 |
// CONSTANTS
|
|
42 |
_LIT( KDRMSettingsPluginResourceFileName, "z:drmsettingspluginrsc.rsc" );
|
|
43 |
|
|
44 |
|
|
45 |
// ============================= LOCAL FUNCTIONS ==============================
|
|
46 |
|
|
47 |
// ========================= MEMBER FUNCTIONS ================================
|
|
48 |
|
|
49 |
// ----------------------------------------------------------------------------
|
|
50 |
// CDRMSettingsPlugin::CDRMSettingsPlugin()
|
|
51 |
//
|
|
52 |
// Constructor
|
|
53 |
// ----------------------------------------------------------------------------
|
|
54 |
//
|
|
55 |
CDRMSettingsPlugin::CDRMSettingsPlugin()
|
|
56 |
: iResourceLoader( *iCoeEnv )
|
|
57 |
{
|
|
58 |
}
|
|
59 |
|
|
60 |
|
|
61 |
// ---------------------------------------------------------------------------
|
|
62 |
// CDRMSettingsPlugin::NewL()
|
|
63 |
//
|
|
64 |
// Symbian OS default constructor
|
|
65 |
// ---------------------------------------------------------------------------
|
|
66 |
CDRMSettingsPlugin* CDRMSettingsPlugin::NewL( TAny* /*aInitParams*/ )
|
|
67 |
{
|
|
68 |
CDRMSettingsPlugin* self = new( ELeave ) CDRMSettingsPlugin;
|
|
69 |
CleanupStack::PushL( self );
|
|
70 |
self->ConstructL();
|
|
71 |
CleanupStack::Pop();
|
|
72 |
return self;
|
|
73 |
}
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
// ---------------------------------------------------------------------------
|
|
78 |
// CDRMSettingsPlugin::ConstructL()
|
|
79 |
//
|
|
80 |
// Symbian OS two-phased constructor
|
|
81 |
// ---------------------------------------------------------------------------
|
|
82 |
void CDRMSettingsPlugin::ConstructL()
|
|
83 |
{
|
|
84 |
FeatureManager::InitializeLibL();
|
|
85 |
|
|
86 |
if ( FeatureManager::FeatureSupported( KFeatureIdWindowsMediaDrm ) )
|
|
87 |
{
|
|
88 |
iWmdrmSupported = ETrue;
|
|
89 |
}
|
|
90 |
|
|
91 |
if ( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) )
|
|
92 |
{
|
|
93 |
iOmadrm2Supported = ETrue;
|
|
94 |
}
|
|
95 |
else
|
|
96 |
{
|
|
97 |
iOmadrm2Supported = EFalse;
|
|
98 |
}
|
|
99 |
|
|
100 |
// Find the resource file
|
|
101 |
TParse parse;
|
|
102 |
parse.Set( KDRMSettingsPluginResourceFileName,
|
|
103 |
&KDC_RESOURCE_FILES_DIR,
|
|
104 |
NULL );
|
|
105 |
TFileName fileName( parse.FullName() );
|
|
106 |
|
|
107 |
// Get language of resource file
|
|
108 |
BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName );
|
|
109 |
|
|
110 |
// Open resource file
|
|
111 |
iResourceLoader.OpenL( fileName );
|
|
112 |
|
|
113 |
BaseConstructL( R_DRM_SETTINGS_VIEW );
|
|
114 |
|
|
115 |
}
|
|
116 |
|
|
117 |
|
|
118 |
// ----------------------------------------------------------------------------
|
|
119 |
// CDRMSettingsPlugin::~CDRMSettingsPlugin
|
|
120 |
//
|
|
121 |
// Destructor
|
|
122 |
// ----------------------------------------------------------------------------
|
|
123 |
CDRMSettingsPlugin::~CDRMSettingsPlugin()
|
|
124 |
{
|
|
125 |
FeatureManager::UnInitializeLib();
|
|
126 |
iResourceLoader.Close();
|
|
127 |
}
|
|
128 |
|
|
129 |
|
|
130 |
// ---------------------------------------------------------------------------
|
|
131 |
// TUid CDRMSettingsPlugin::Id()
|
|
132 |
//
|
|
133 |
// Returns view's ID.
|
|
134 |
// ---------------------------------------------------------------------------
|
|
135 |
TUid CDRMSettingsPlugin::Id() const
|
|
136 |
{
|
|
137 |
return KDRMSettingsPluginUid;
|
|
138 |
}
|
|
139 |
|
|
140 |
|
|
141 |
// ========================= From CGSPluginInterface ==================
|
|
142 |
|
|
143 |
// ----------------------------------------------------------------------------
|
|
144 |
// CDRMSettingsPlugin::GetCaption
|
|
145 |
//
|
|
146 |
// Return application/view caption.
|
|
147 |
// ----------------------------------------------------------------------------
|
|
148 |
//
|
|
149 |
void CDRMSettingsPlugin::GetCaptionL( TDes& aCaption ) const
|
|
150 |
{
|
|
151 |
// the resource file is already opened.
|
|
152 |
HBufC* result( StringLoader::LoadL( R_DRM_SETTINGS_VIEW_CAPTION ) );
|
|
153 |
aCaption.Copy( *result );
|
|
154 |
delete result;
|
|
155 |
}
|
|
156 |
|
|
157 |
|
|
158 |
// ----------------------------------------------------------------------------
|
|
159 |
// CDRMSettingsPlugin::PluginProviderCategory
|
|
160 |
//
|
|
161 |
// A means to identify the location of this plug-in in the framework.
|
|
162 |
// ----------------------------------------------------------------------------
|
|
163 |
//
|
|
164 |
TInt CDRMSettingsPlugin::PluginProviderCategory() const
|
|
165 |
{
|
|
166 |
//To identify internal plug-ins.
|
|
167 |
return KGSPluginProviderInternal;
|
|
168 |
}
|
|
169 |
|
|
170 |
|
|
171 |
// ----------------------------------------------------------------------------
|
|
172 |
// CDRMSettingsPlugin::Visible
|
|
173 |
//
|
|
174 |
// Provides the visibility status of self to framework.
|
|
175 |
// ----------------------------------------------------------------------------
|
|
176 |
//
|
|
177 |
TBool CDRMSettingsPlugin::Visible() const
|
|
178 |
{
|
|
179 |
TBool visible( EFalse );
|
|
180 |
|
|
181 |
// The plugin is visible if __DRM_OMA2 or __WINDOWS_MEDIA_DRM are enabled.
|
|
182 |
if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) ||
|
|
183 |
FeatureManager::FeatureSupported( KFeatureIdWindowsMediaDrm ) )
|
|
184 |
{
|
|
185 |
visible = ETrue;
|
|
186 |
}
|
|
187 |
|
|
188 |
return visible;
|
|
189 |
}
|
|
190 |
|
|
191 |
|
|
192 |
// ---------------------------------------------------------------------------
|
|
193 |
// CDRMSettingsPlugin::HandleCommandL(TInt aCommand)
|
|
194 |
//
|
|
195 |
// Handles commands directed to this class.
|
|
196 |
// ---------------------------------------------------------------------------
|
|
197 |
void CDRMSettingsPlugin::HandleCommandL( TInt aCommand )
|
|
198 |
{
|
|
199 |
switch ( aCommand )
|
|
200 |
{
|
|
201 |
case EDRMSettingsCmdAppChangeMSK:
|
|
202 |
{
|
|
203 |
const TInt currentFeatureId( Container()->CurrentFeatureId() );
|
|
204 |
|
|
205 |
switch ( currentFeatureId )
|
|
206 |
{
|
|
207 |
#ifdef __DRM_OMA2
|
|
208 |
case EDRMSettingsIdTransactionTracking:
|
|
209 |
if ( iOmadrm2Supported )
|
|
210 |
{
|
|
211 |
UpdateTransactionTrackingSettingL( EFalse );
|
|
212 |
}
|
|
213 |
break;
|
|
214 |
|
|
215 |
#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION
|
|
216 |
case EDRMSettingsIdAutomaticActivation:
|
|
217 |
if ( iOmadrm2Supported )
|
|
218 |
{
|
|
219 |
UpdateAutomaticActivationSettingL( EFalse );
|
|
220 |
}
|
|
221 |
break;
|
|
222 |
#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION
|
|
223 |
|
|
224 |
#ifdef RD_DRM_METERING
|
|
225 |
case EDRMSettingsIdUsageReporting:
|
|
226 |
if ( iOmadrm2Supported )
|
|
227 |
{
|
|
228 |
UpdateUsageReportingSettingL();
|
|
229 |
}
|
|
230 |
break;
|
|
231 |
#endif // RD_DRM_METERING
|
|
232 |
#endif // __DRM_OMA2
|
|
233 |
|
|
234 |
case EDRMSettingsIdWMDRMLicenseDeletion:
|
|
235 |
|
|
236 |
if ( iWmdrmSupported )
|
|
237 |
{
|
|
238 |
DoWMDRMLicenseDeletionL();
|
|
239 |
}
|
|
240 |
|
|
241 |
break;
|
|
242 |
|
|
243 |
default:
|
|
244 |
|
|
245 |
break;
|
|
246 |
}
|
|
247 |
|
|
248 |
break;
|
|
249 |
}
|
|
250 |
case EDRMSettingsCmdAppChange:
|
|
251 |
{
|
|
252 |
const TInt currentFeatureId( Container()->CurrentFeatureId() );
|
|
253 |
|
|
254 |
switch ( currentFeatureId )
|
|
255 |
{
|
|
256 |
#ifdef __DRM_OMA2
|
|
257 |
case EDRMSettingsIdTransactionTracking:
|
|
258 |
if ( iOmadrm2Supported )
|
|
259 |
{
|
|
260 |
UpdateTransactionTrackingSettingL( ETrue );
|
|
261 |
}
|
|
262 |
break;
|
|
263 |
#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION
|
|
264 |
case EDRMSettingsIdAutomaticActivation:
|
|
265 |
if ( iOmadrm2Supported )
|
|
266 |
{
|
|
267 |
UpdateAutomaticActivationSettingL( ETrue );
|
|
268 |
}
|
|
269 |
break;
|
|
270 |
#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION
|
|
271 |
|
|
272 |
#ifdef RD_DRM_METERING
|
|
273 |
case EDRMSettingsIdUsageReporting:
|
|
274 |
if ( iOmadrm2Supported )
|
|
275 |
{
|
|
276 |
UpdateUsageReportingSettingL();
|
|
277 |
}
|
|
278 |
break;
|
|
279 |
#endif // RD_DRM_METERING
|
|
280 |
#endif // __DRM_OMA2
|
|
281 |
|
|
282 |
case EDRMSettingsIdWMDRMLicenseDeletion:
|
|
283 |
|
|
284 |
if ( iWmdrmSupported )
|
|
285 |
{
|
|
286 |
DoWMDRMLicenseDeletionL();
|
|
287 |
}
|
|
288 |
|
|
289 |
break;
|
|
290 |
|
|
291 |
default:
|
|
292 |
|
|
293 |
break;
|
|
294 |
}
|
|
295 |
break;
|
|
296 |
}
|
|
297 |
case EAknSoftkeyBack:
|
|
298 |
|
|
299 |
iAppUi->ActivateLocalViewL( KGSSecurityPluginUid );
|
|
300 |
|
|
301 |
break;
|
|
302 |
|
|
303 |
case EAknCmdHelp:
|
|
304 |
{
|
|
305 |
|
|
306 |
if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
|
|
307 |
{
|
|
308 |
HlpLauncher::LaunchHelpApplicationL(
|
|
309 |
iEikonEnv->WsSession(),
|
|
310 |
iAppUi->AppHelpContextL() );
|
|
311 |
}
|
|
312 |
|
|
313 |
break;
|
|
314 |
|
|
315 |
}
|
|
316 |
default:
|
|
317 |
|
|
318 |
iAppUi->HandleCommandL( aCommand );
|
|
319 |
|
|
320 |
break;
|
|
321 |
}
|
|
322 |
}
|
|
323 |
|
|
324 |
|
|
325 |
// ---------------------------------------------------------------------------
|
|
326 |
// CDRMSettingsPlugin::UpdateListBoxL
|
|
327 |
//
|
|
328 |
// Updates listbox items.
|
|
329 |
// ---------------------------------------------------------------------------
|
|
330 |
//
|
|
331 |
void CDRMSettingsPlugin::UpdateListBoxL( TInt aItemId )
|
|
332 |
{
|
|
333 |
Container()->UpdateListBoxL( aItemId );
|
|
334 |
}
|
|
335 |
|
|
336 |
|
|
337 |
// ----------------------------------------------------------------------------
|
|
338 |
// CDRMSettingsPlugin::Container
|
|
339 |
//
|
|
340 |
// Return handle to container class.
|
|
341 |
// ----------------------------------------------------------------------------
|
|
342 |
//
|
|
343 |
CDRMSettingsPluginContainer* CDRMSettingsPlugin::Container()
|
|
344 |
{
|
|
345 |
return static_cast<CDRMSettingsPluginContainer*>( iContainer );
|
|
346 |
}
|
|
347 |
|
|
348 |
|
|
349 |
// ---------------------------------------------------------------------------
|
|
350 |
// CDRMSettingsPlugin::NewContainerL()
|
|
351 |
//
|
|
352 |
// Creates new iContainer.
|
|
353 |
// ---------------------------------------------------------------------------
|
|
354 |
//
|
|
355 |
void CDRMSettingsPlugin::NewContainerL()
|
|
356 |
{
|
|
357 |
iContainer = new( ELeave ) CDRMSettingsPluginContainer( iWmdrmSupported,
|
|
358 |
iOmadrm2Supported );
|
|
359 |
}
|
|
360 |
|
|
361 |
|
|
362 |
// ---------------------------------------------------------------------------
|
|
363 |
// CDRMSettingsPlugin::HandleListBoxSelectionL()
|
|
364 |
//
|
|
365 |
// Handles events raised through a rocker key. Checks the run-time support of
|
|
366 |
// Oma Drm 2 when needed.
|
|
367 |
// ---------------------------------------------------------------------------
|
|
368 |
void CDRMSettingsPlugin::HandleListBoxSelectionL()
|
|
369 |
{
|
|
370 |
const TInt currentFeatureId( Container()->CurrentFeatureId() );
|
|
371 |
|
|
372 |
switch ( currentFeatureId )
|
|
373 |
{
|
|
374 |
#ifdef __DRM_OMA2
|
|
375 |
case EDRMSettingsIdTransactionTracking:
|
|
376 |
if ( iOmadrm2Supported )
|
|
377 |
{
|
|
378 |
UpdateTransactionTrackingSettingL( EFalse );
|
|
379 |
}
|
|
380 |
break;
|
|
381 |
#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION
|
|
382 |
case EDRMSettingsIdAutomaticActivation:
|
|
383 |
if ( iOmadrm2Supported )
|
|
384 |
{
|
|
385 |
UpdateAutomaticActivationSettingL( EFalse );
|
|
386 |
}
|
|
387 |
break;
|
|
388 |
#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION
|
|
389 |
|
|
390 |
#ifdef RD_DRM_METERING
|
|
391 |
case EDRMSettingsIdUsageReporting:
|
|
392 |
if ( iOmadrm2Supported )
|
|
393 |
{
|
|
394 |
UpdateUsageReportingSettingL();
|
|
395 |
}
|
|
396 |
break;
|
|
397 |
#endif // RD_DRM_METERING
|
|
398 |
#endif // __DRM_OMA2
|
|
399 |
|
|
400 |
case EDRMSettingsIdWMDRMLicenseDeletion:
|
|
401 |
|
|
402 |
if ( iWmdrmSupported )
|
|
403 |
{
|
|
404 |
DoWMDRMLicenseDeletionL();
|
|
405 |
}
|
|
406 |
|
|
407 |
break;
|
|
408 |
|
|
409 |
default:
|
|
410 |
|
|
411 |
break;
|
|
412 |
}
|
|
413 |
}
|
|
414 |
|
|
415 |
|
|
416 |
// ---------------------------------------------------------------------------
|
|
417 |
// CDRMSettingsPlugin::UpdateTransactionTrackingSettingL
|
|
418 |
//
|
|
419 |
// Display Transaction tracking setting page.
|
|
420 |
// ---------------------------------------------------------------------------
|
|
421 |
//
|
|
422 |
void CDRMSettingsPlugin::UpdateTransactionTrackingSettingL( TBool aShowSettingPage )
|
|
423 |
{
|
|
424 |
if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) )
|
|
425 |
{
|
|
426 |
TInt currentValue( Container()->Model()->TransactionTrackingStateL() );
|
|
427 |
TBool isValueUpdated( EFalse );
|
|
428 |
|
|
429 |
if ( aShowSettingPage )
|
|
430 |
{
|
|
431 |
isValueUpdated = ShowTransactionTrackingSettingPageL( currentValue );
|
|
432 |
}
|
|
433 |
else
|
|
434 |
{
|
|
435 |
switch ( currentValue )
|
|
436 |
{
|
|
437 |
case KDRMTransactionTrackingDisabled:
|
|
438 |
|
|
439 |
currentValue = KDRMTransactionTrackingEnabled;
|
|
440 |
|
|
441 |
break;
|
|
442 |
|
|
443 |
case KDRMTransactionTrackingEnabled:
|
|
444 |
|
|
445 |
currentValue = KDRMTransactionTrackingDisabled;
|
|
446 |
|
|
447 |
break;
|
|
448 |
|
|
449 |
default:
|
|
450 |
|
|
451 |
break;
|
|
452 |
}
|
|
453 |
isValueUpdated = ETrue;
|
|
454 |
}
|
|
455 |
// If value is updated, store it to model:
|
|
456 |
if ( isValueUpdated )
|
|
457 |
{
|
|
458 |
Container()->Model()->SetTransactionTrackingStateL( currentValue );
|
|
459 |
UpdateListBoxL( EDRMSettingsIdTransactionTracking );
|
|
460 |
}
|
|
461 |
}
|
|
462 |
}
|
|
463 |
|
|
464 |
|
|
465 |
// ---------------------------------------------------------------------------
|
|
466 |
// CDRMSettingsPlugin::ShowTransactionTrackingSettingPageL()
|
|
467 |
//
|
|
468 |
// Display transaction tracking setting page. Selected listbox item index
|
|
469 |
// must be mapped to transaction tracking state because index value is
|
|
470 |
// different from state value.
|
|
471 |
// ---------------------------------------------------------------------------
|
|
472 |
//
|
|
473 |
TBool CDRMSettingsPlugin::ShowTransactionTrackingSettingPageL(
|
|
474 |
TInt& aTTState )
|
|
475 |
{
|
|
476 |
// in case DRM Phase 2 is not supported, return EFalse.
|
|
477 |
TBool isValueUpdated( EFalse );
|
|
478 |
TInt selectedTTItemIndex( 0 );
|
|
479 |
TInt originalTTState( aTTState );
|
|
480 |
|
|
481 |
// Set selected listbox item to current transaction tracking state:
|
|
482 |
switch ( aTTState )
|
|
483 |
{
|
|
484 |
case KDRMTransactionTrackingDisabled:
|
|
485 |
|
|
486 |
selectedTTItemIndex = KDRMTTItemIndexDisabled;
|
|
487 |
|
|
488 |
break;
|
|
489 |
|
|
490 |
case KDRMTransactionTrackingEnabled:
|
|
491 |
|
|
492 |
selectedTTItemIndex = KDRMTTItemIndexEnabled;
|
|
493 |
|
|
494 |
break;
|
|
495 |
}
|
|
496 |
|
|
497 |
CDesCArrayFlat* items(
|
|
498 |
iCoeEnv->ReadDesC16ArrayResourceL( R_TTRACKING_SETTING_PAGE_LBX ) );
|
|
499 |
CleanupStack::PushL( items );
|
|
500 |
CAknRadioButtonSettingPage* dlg(
|
|
501 |
new (ELeave) CAknRadioButtonSettingPage( R_TTRACKING_SETTING_PAGE,
|
|
502 |
selectedTTItemIndex,
|
|
503 |
items ) );
|
|
504 |
|
|
505 |
dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );
|
|
506 |
CleanupStack::PopAndDestroy( items );
|
|
507 |
|
|
508 |
// Map selected listbox item to correct state:
|
|
509 |
switch ( selectedTTItemIndex )
|
|
510 |
{
|
|
511 |
case KDRMTTItemIndexDisabled:
|
|
512 |
|
|
513 |
aTTState = KDRMTransactionTrackingDisabled;
|
|
514 |
|
|
515 |
break;
|
|
516 |
|
|
517 |
case KDRMTTItemIndexEnabled:
|
|
518 |
|
|
519 |
aTTState = KDRMTransactionTrackingEnabled;
|
|
520 |
|
|
521 |
break;
|
|
522 |
}
|
|
523 |
|
|
524 |
// Check is value updated:
|
|
525 |
if( aTTState != originalTTState )
|
|
526 |
{
|
|
527 |
isValueUpdated = ETrue;
|
|
528 |
}
|
|
529 |
|
|
530 |
return isValueUpdated;
|
|
531 |
}
|
|
532 |
|
|
533 |
|
|
534 |
// ---------------------------------------------------------------------------
|
|
535 |
// CDRMSettingsPlugin::UpdateAutomaticActivationSettingL
|
|
536 |
//
|
|
537 |
// Display Automatic activation setting page.
|
|
538 |
// ---------------------------------------------------------------------------
|
|
539 |
//
|
|
540 |
void CDRMSettingsPlugin::UpdateAutomaticActivationSettingL( TBool aShowSettingPage )
|
|
541 |
{
|
|
542 |
if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) )
|
|
543 |
{
|
|
544 |
TInt currentValue( Container()->Model()->AutomaticActivationStateL() );
|
|
545 |
TBool isValueUpdated( EFalse );
|
|
546 |
|
|
547 |
if ( aShowSettingPage )
|
|
548 |
{
|
|
549 |
isValueUpdated = ShowAutomaticActivationSettingPageL( currentValue );
|
|
550 |
}
|
|
551 |
else
|
|
552 |
{
|
|
553 |
switch ( currentValue )
|
|
554 |
{
|
|
555 |
case KDRMAutomaticActivationNotAllowed:
|
|
556 |
|
|
557 |
currentValue = KDRMAutomaticActivationAllowed;
|
|
558 |
|
|
559 |
break;
|
|
560 |
|
|
561 |
case KDRMAutomaticActivationAllowed:
|
|
562 |
|
|
563 |
currentValue = KDRMAutomaticActivationNotAllowed;
|
|
564 |
|
|
565 |
break;
|
|
566 |
|
|
567 |
default:
|
|
568 |
|
|
569 |
break;
|
|
570 |
}
|
|
571 |
isValueUpdated = ETrue;
|
|
572 |
}
|
|
573 |
// If value is updated, store it to model:
|
|
574 |
if ( isValueUpdated )
|
|
575 |
{
|
|
576 |
Container()->Model()->SetAutomaticActivationStateL( currentValue );
|
|
577 |
UpdateListBoxL( EDRMSettingsIdAutomaticActivation );
|
|
578 |
}
|
|
579 |
}
|
|
580 |
}
|
|
581 |
|
|
582 |
|
|
583 |
// ---------------------------------------------------------------------------
|
|
584 |
// CDRMSettingsPlugin::ShowAutomaticActivationSettingPageL()
|
|
585 |
//
|
|
586 |
// Display Automatic activation setting page. Selected listbox item index
|
|
587 |
// must be mapped to automatic activation state because index value is
|
|
588 |
// different from state value.
|
|
589 |
// ---------------------------------------------------------------------------
|
|
590 |
//
|
|
591 |
TBool CDRMSettingsPlugin::ShowAutomaticActivationSettingPageL(
|
|
592 |
TInt& aAAState )
|
|
593 |
{
|
|
594 |
// in case DRM Phase 2 is not supported, return EFalse.
|
|
595 |
TBool isValueUpdated( EFalse );
|
|
596 |
TInt selectedAAItemIndex( 0 );
|
|
597 |
TInt originalAAState( aAAState );
|
|
598 |
|
|
599 |
// Set selected listbox item to current state:
|
|
600 |
switch ( aAAState )
|
|
601 |
{
|
|
602 |
case KDRMAutomaticActivationNotAllowed:
|
|
603 |
|
|
604 |
selectedAAItemIndex = KDRMAAItemIndexDisabled;
|
|
605 |
|
|
606 |
break;
|
|
607 |
|
|
608 |
case KDRMAutomaticActivationAllowed:
|
|
609 |
|
|
610 |
selectedAAItemIndex = KDRMAAItemIndexEnabled;
|
|
611 |
|
|
612 |
break;
|
|
613 |
}
|
|
614 |
|
|
615 |
CDesCArrayFlat* items(
|
|
616 |
iCoeEnv->ReadDesC16ArrayResourceL( R_AUTOM_ACTIV_SETTING_PAGE_LBX ) );
|
|
617 |
CleanupStack::PushL( items );
|
|
618 |
CAknRadioButtonSettingPage* dlg(
|
|
619 |
new (ELeave) CAknRadioButtonSettingPage( R_AUTOM_ACTIV_SETTING_PAGE,
|
|
620 |
selectedAAItemIndex,
|
|
621 |
items ) );
|
|
622 |
|
|
623 |
dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );
|
|
624 |
CleanupStack::PopAndDestroy( items );
|
|
625 |
|
|
626 |
// Map selected listbox item to correct state:
|
|
627 |
switch ( selectedAAItemIndex )
|
|
628 |
{
|
|
629 |
case KDRMAAItemIndexDisabled:
|
|
630 |
|
|
631 |
aAAState = KDRMAutomaticActivationNotAllowed;
|
|
632 |
|
|
633 |
break;
|
|
634 |
|
|
635 |
case KDRMAAItemIndexEnabled:
|
|
636 |
|
|
637 |
aAAState = KDRMAutomaticActivationAllowed;
|
|
638 |
|
|
639 |
break;
|
|
640 |
|
|
641 |
}
|
|
642 |
|
|
643 |
// Check is value updated:
|
|
644 |
if( aAAState != originalAAState )
|
|
645 |
{
|
|
646 |
isValueUpdated = ETrue;
|
|
647 |
}
|
|
648 |
|
|
649 |
return isValueUpdated;
|
|
650 |
}
|
|
651 |
|
|
652 |
|
|
653 |
// ---------------------------------------------------------------------------
|
|
654 |
// CDRMSettingsPlugin::UpdateUsageReportingSettingL
|
|
655 |
//
|
|
656 |
// Display Usage Reporting setting page.
|
|
657 |
// ---------------------------------------------------------------------------
|
|
658 |
//
|
|
659 |
void CDRMSettingsPlugin::UpdateUsageReportingSettingL()
|
|
660 |
{
|
|
661 |
TBool isValueUpdated( EFalse );
|
|
662 |
|
|
663 |
if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) )
|
|
664 |
{
|
|
665 |
CDRMSettingsModel* model( this->Container()->Model() );
|
|
666 |
|
|
667 |
CDRMSettingUsageList* usageList( CDRMSettingUsageList::NewL( model ) );
|
|
668 |
CleanupStack::PushL( usageList );
|
|
669 |
|
|
670 |
CDrmSettingUsageCheckBox* usageCheckBox(
|
|
671 |
new (ELeave) CDrmSettingUsageCheckBox(
|
|
672 |
R_DRM_SETTINGS_METERING_CHECKBOX_PAGE,
|
|
673 |
usageList,
|
|
674 |
model,
|
|
675 |
this ) );
|
|
676 |
|
|
677 |
isValueUpdated =
|
|
678 |
usageCheckBox->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted );
|
|
679 |
|
|
680 |
CleanupStack::PopAndDestroy( usageList );
|
|
681 |
}
|
|
682 |
|
|
683 |
if ( isValueUpdated )
|
|
684 |
{
|
|
685 |
UpdateListBoxL( EDRMSettingsIdUsageReporting );
|
|
686 |
}
|
|
687 |
}
|
|
688 |
|
|
689 |
// ---------------------------------------------------------------------------
|
|
690 |
// CDRMSettingsPlugin::DoWMDRMLicenseDeletionL
|
|
691 |
//
|
|
692 |
// Display WMDRM license deletion setting page.
|
|
693 |
// ---------------------------------------------------------------------------
|
|
694 |
//
|
|
695 |
void CDRMSettingsPlugin::DoWMDRMLicenseDeletionL()
|
|
696 |
{
|
|
697 |
if ( iWmdrmSupported )
|
|
698 |
{
|
|
699 |
TInt r = KErrNone;
|
|
700 |
RLibrary library;
|
|
701 |
r = library.Load( KWmdrmPkClientWrapperName );
|
|
702 |
if( !r )
|
|
703 |
{
|
|
704 |
CleanupClosePushL( library );
|
|
705 |
CWmDrmPkClientWrapper* wrapper =
|
|
706 |
(CWmDrmPkClientWrapper*)library.Lookup( KWmdrmPkClientNewL )();
|
|
707 |
CleanupStack::PushL( wrapper );
|
|
708 |
User::LeaveIfError( wrapper->Connect() );
|
|
709 |
wrapper->DeleteRights();
|
|
710 |
wrapper->Close();
|
|
711 |
CleanupStack::PopAndDestroy( 2, &library );
|
|
712 |
}
|
|
713 |
}
|
|
714 |
}
|
|
715 |
|
|
716 |
// ----------------------------------------------------------------------------
|
|
717 |
// CDRMSettingsPlugin::DynInitMenuPaneL()
|
|
718 |
//
|
|
719 |
// Display the dynamic menu
|
|
720 |
// ----------------------------------------------------------------------------
|
|
721 |
void CDRMSettingsPlugin::DynInitMenuPaneL(
|
|
722 |
TInt aResourceId,
|
|
723 |
CEikMenuPane* aMenuPane )
|
|
724 |
{
|
|
725 |
// show or hide the 'help' menu item when supported
|
|
726 |
if( aResourceId == R_DRM_SETTINGS_MENU_ITEM_EXIT )
|
|
727 |
{
|
|
728 |
User::LeaveIfNull( aMenuPane );
|
|
729 |
|
|
730 |
if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) )
|
|
731 |
{
|
|
732 |
if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
|
|
733 |
{
|
|
734 |
aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
|
|
735 |
}
|
|
736 |
else
|
|
737 |
{
|
|
738 |
aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
|
|
739 |
}
|
|
740 |
}
|
|
741 |
else
|
|
742 |
{
|
|
743 |
aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
|
|
744 |
}
|
|
745 |
}
|
|
746 |
}
|
|
747 |
|
|
748 |
|
|
749 |
|
|
750 |
// End of File
|