commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp
branchRCL_3
changeset 12 8a03a285ab14
parent 11 e16d72588c28
child 15 04da681812a9
equal deleted inserted replaced
11:e16d72588c28 12:8a03a285ab14
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include <dcfrep.h>
    20 #include <DcfRep.h>
    21 #include <dcfentry.h>
    21 #include <DcfEntry.h>
    22 #include <drmcommon.h>
    22 #include <DRMCommon.h>
    23 #include <dcfcommon.h>
    23 #include <DcfCommon.h>
    24 #include <wmdrmagent.h> // for WMDRM file details view
    24 #include <wmdrmagent.h> // for WMDRM file details view
    25 
    25 
    26 #include <drmrightsmanager.rsg>
    26 #include <DRMRightsManager.rsg>
    27 
    27 
    28 #include <aknwaitdialog.h>
    28 #include <AknWaitDialog.h>
    29 #include <aknlistquerydialog.h>
    29 #include <aknlistquerydialog.h>
    30 #include <stringloader.h>
    30 #include <StringLoader.h>
    31 #include <aknnavide.h>
    31 #include <aknnavide.h>
    32 #include <akndef.h>
    32 #include <AknDef.h>
    33 #include <barsread.h>  // for resource reader
    33 #include <barsread.h>  // for resource reader
    34 #include <centralrepository.h>
    34 #include <centralrepository.h>
    35 #include <coeutils.h>
    35 #include <coeutils.h>
    36 
    36 
    37 #include <starterclient.h>
    37 #include <starterclient.h>
    41 
    41 
    42 // caf
    42 // caf
    43 #include <caf/data.h>
    43 #include <caf/data.h>
    44 #include <caf/caftypes.h>
    44 #include <caf/caftypes.h>
    45 
    45 
    46 #include "drmrightsmgrappui.h"
    46 #include "DRMRightsMgrAppUi.h"
    47 #include "drmrightsmgrdetailsview.h"
    47 #include "DRMRightsMgrDetailsView.h"
    48 #include "drmrightsmgrdocument.h"
    48 #include "DRMRightsMgrDocument.h"
    49 #include "drmcommonutilities.h"
    49 #include "DRMCommonUtilities.h"
    50 #include "drmuilogger.h"
    50 #include "DRMUILogger.h"
    51 #include "drmrightsmanagerprivatecrkeys.h"
    51 #include "DRMRightsManagerPrivateCRKeys.h"
    52 #include "drmclockclient.h"
    52 #include "DRMClockClient.h"
    53 #include "drmutilityinternaltypes.h"
    53 #include "drmutilityinternaltypes.h"
    54 
    54 
    55 #include "oma1dcf.h"
    55 #include "Oma1Dcf.h"
    56 #include "oma2dcf.h"
    56 #include "oma2dcf.h"
    57 // CONSTANTS
    57 // CONSTANTS
    58 _LIT8( Kflk, "flk:" );
    58 _LIT8( Kflk, "flk:" );
    59 _LIT8( Kldf, "ldf:" );
    59 _LIT8( Kldf, "ldf:" );
    60 
    60 
    81 // ---------------------------------------------------------
    81 // ---------------------------------------------------------
    82 //
    82 //
    83 void CDRMRightsMgrAppUi::ConstructL()
    83 void CDRMRightsMgrAppUi::ConstructL()
    84     {
    84     {
    85     CLOG_WRITE( "-->ConstructL" );
    85     CLOG_WRITE( "-->ConstructL" );
    86     
    86 
    87     iCoeEnv->AddForegroundObserverL( *this );
    87     iCoeEnv->AddForegroundObserverL( *this );
    88     
    88 
    89     CDRMRightsMgrDetailsView* detailsView( NULL );
    89     CDRMRightsMgrDetailsView* detailsView( NULL );
    90 
    90 
    91     BaseConstructL( EAknEnableSkin | EAppOrientationAutomatic | 
    91     BaseConstructL( EAknEnableSkin | EAppOrientationAutomatic |
    92     	EAknEnableMSK | EAknSingleClickCompatible  );
    92         EAknEnableMSK | EAknSingleClickCompatible  );
    93 
    93 
    94     User::LeaveIfError( iRightsClient.Connect() );
    94     User::LeaveIfError( iRightsClient.Connect() );
    95     iDRMCommon = DRMCommon::NewL();
    95     iDRMCommon = DRMCommon::NewL();
    96     if ( !iDRMCommon )
    96     if ( !iDRMCommon )
    97         {
    97         {
   119 // CDRMRightsMgrAppUi::~CDRMRightsMgrAppUi
   119 // CDRMRightsMgrAppUi::~CDRMRightsMgrAppUi
   120 // ----------------------------------------------------
   120 // ----------------------------------------------------
   121 //
   121 //
   122 CDRMRightsMgrAppUi::~CDRMRightsMgrAppUi()
   122 CDRMRightsMgrAppUi::~CDRMRightsMgrAppUi()
   123     {
   123     {
   124     
   124 
   125     iCoeEnv->RemoveForegroundObserver( *this );
   125     iCoeEnv->RemoveForegroundObserver( *this );
   126     
   126 
   127     delete iWaitDialog;
   127     delete iWaitDialog;
   128 
   128 
   129     delete iDRMCommon;
   129     delete iDRMCommon;
   130 
   130 
   131     iRightsClient.Close();
   131     iRightsClient.Close();
   132 
   132 
   133     if ( iStartEmbedded && iDoorObserver )
   133     if ( iStartEmbedded && iDoorObserver )
   134         {
   134         {
   135         iDoorObserver->NotifyExit( MApaEmbeddedDocObserver::ENoChanges );
   135         iDoorObserver->NotifyExit( MApaEmbeddedDocObserver::ENoChanges );
   136         }
   136         }
   137         
   137 
   138     if ( iContentURI )
   138     if ( iContentURI )
   139         {
   139         {
   140         delete iContentURI;
   140         delete iContentURI;
   141         }
   141         }
   142         
   142 
   143     }
   143     }
   144 
   144 
   145 
   145 
   146 // ---------------------------------------------------------
   146 // ---------------------------------------------------------
   147 // CDRMRightsMgrAppUi::HandleKeyEventL
   147 // CDRMRightsMgrAppUi::HandleKeyEventL
   198                                                const TUint32 aLocalID,
   198                                                const TUint32 aLocalID,
   199                                                const TBool aEmbedded,
   199                                                const TBool aEmbedded,
   200                                                const TInt aDrmScheme )
   200                                                const TInt aDrmScheme )
   201     {
   201     {
   202 
   202 
   203     // Store the content related information when the details view 
   203     // Store the content related information when the details view
   204     // is to be shown for the first time so that the information will be
   204     // is to be shown for the first time so that the information will be
   205     // available for details view refreshing in the future.
   205     // available for details view refreshing in the future.
   206     if ( !iContentURI )
   206     if ( !iContentURI )
   207         {
   207         {
   208         iDrmScheme = aDrmScheme;
   208         iDrmScheme = aDrmScheme;
   209         iLocalID = aLocalID;
   209         iLocalID = aLocalID;
   210         iContentURI = aContentURI.AllocL();
   210         iContentURI = aContentURI.AllocL();
   211         }
   211         }
   212     
   212 
   213     // For storing WM DRM rights information
   213     // For storing WM DRM rights information
   214     ContentAccess::RStreamablePtrArray<ContentAccess::CRightsInfo> array;
   214     ContentAccess::RStreamablePtrArray<ContentAccess::CRightsInfo> array;
   215     CleanupClosePushL( array );
   215     CleanupClosePushL( array );
   216 
   216 
   217     TInt status( KErrCANoRights );
   217     TInt status( KErrCANoRights );
   229     // Check the status of rights. Currently supports OMA and WM DRM.
   229     // Check the status of rights. Currently supports OMA and WM DRM.
   230     switch ( iDrmScheme )
   230     switch ( iDrmScheme )
   231         {
   231         {
   232         case EDrmSchemeOmaDrm:
   232         case EDrmSchemeOmaDrm:
   233             CheckOmaDrmRightsL( aContentURI, aLocalID, rights, status );
   233             CheckOmaDrmRightsL( aContentURI, aLocalID, rights, status );
   234             if ( status < 0 ) 
   234             if ( status < 0 )
   235                 {
   235                 {
   236                 rights = NULL;
   236                 rights = NULL;
   237                 }
   237                 }
   238             break;
   238             break;
   239 
   239 
   358         if ( err == KErrNotFound || itemNameBuf->Length() == 0 )
   358         if ( err == KErrNotFound || itemNameBuf->Length() == 0 )
   359             {
   359             {
   360             // Do not show name if group rights or forward lock
   360             // Do not show name if group rights or forward lock
   361             if ( !aIsGroup )
   361             if ( !aIsGroup )
   362                 {
   362                 {
   363                 if ( ( iRightsClient.ForwardLockURI( buffer ) == 
   363                 if ( ( iRightsClient.ForwardLockURI( buffer ) ==
   364                         KErrNone ) && buffer )  
   364                         KErrNone ) && buffer )
   365                     {
   365                     {
   366                     
   366 
   367                     // Not forward lock
   367                     // Not forward lock
   368                     if ( aID.Compare( *buffer ) != 0 )    
   368                     if ( aID.Compare( *buffer ) != 0 )
   369                         {
   369                         {
   370                         parse.Set( aFullName, NULL, NULL );
   370                         parse.Set( aFullName, NULL, NULL );
   371                         aItemName = parse.NameAndExt();
   371                         aItemName = parse.NameAndExt();
   372                         }   
   372                         }
   373                     delete buffer;
   373                     delete buffer;
   374                     buffer = NULL;
   374                     buffer = NULL;
   375                     
   375 
   376                     }       
   376                     }
   377                 else
   377                 else
   378                     {
   378                     {
   379                     parse.Set( aFullName, NULL, NULL );
   379                     parse.Set( aFullName, NULL, NULL );
   380                     aItemName = parse.NameAndExt();
   380                     aItemName = parse.NameAndExt();
   381                     }
   381                     }
   393                     // Combined delivery
   393                     // Combined delivery
   394                     aItemName = *itemNameBuf;
   394                     aItemName = *itemNameBuf;
   395                     }
   395                     }
   396                 delete buffer;
   396                 delete buffer;
   397                 }
   397                 }
   398             else 
   398             else
   399                 {
   399                 {
   400                 // Do not show name if having group rights
   400                 // Do not show name if having group rights
   401                 if ( !aIsGroup )
   401                 if ( !aIsGroup )
   402                     {
   402                     {
   403                     aItemName = *itemNameBuf;
   403                     aItemName = *itemNameBuf;
   555     {
   555     {
   556     // Refresh details view when the details view is returned
   556     // Refresh details view when the details view is returned
   557     // from the background to the foreground.
   557     // from the background to the foreground.
   558     if ( iForegroundHasBeenActive && iContentURI )
   558     if ( iForegroundHasBeenActive && iContentURI )
   559         {
   559         {
   560         StartOnlyForDetailsL( iContentURI->Des(), iLocalID, 
   560         StartOnlyForDetailsL( iContentURI->Des(), iLocalID,
   561             iStartEmbedded, iDrmScheme );
   561             iStartEmbedded, iDrmScheme );
   562         }
   562         }
   563     }
   563     }
   564 
   564 
   565 
   565 
   755                 {
   755                 {
   756                 fullName = entry->FileName();
   756                 fullName = entry->FileName();
   757                 SetSelectedItemFullName( fullName );
   757                 SetSelectedItemFullName( fullName );
   758 
   758 
   759                 TFileName itemName;
   759                 TFileName itemName;
   760                 
   760 
   761                 if ( entry->GroupId().Length() > 0 )
   761                 if ( entry->GroupId().Length() > 0 )
   762                     {
   762                     {
   763                     GetItemNameL( fullName, itemName, aContentURI, ETrue );
   763                     GetItemNameL( fullName, itemName, aContentURI, ETrue );
   764                     }    
   764                     }
   765                 else 
   765                 else
   766                     {
   766                     {
   767                     GetItemNameL( fullName, itemName, aContentURI, EFalse );
   767                     GetItemNameL( fullName, itemName, aContentURI, EFalse );
   768                     }
   768                     }
   769                 
   769 
   770                 delete entry;
   770                 delete entry;
   771                 
   771 
   772                 SetSelectedItemName( itemName );
   772                 SetSelectedItemName( itemName );
   773 
   773 
   774                 if ( GetItemDataL( fullName, aContentURI, listable,
   774                 if ( GetItemDataL( fullName, aContentURI, listable,
   775                     sendable ) == KErrNone )
   775                     sendable ) == KErrNone )
   776                     {
   776                     {