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