commondrm/drmutility/src/DrmUtilityInfoNoteWrapper.cpp
changeset 23 493788a4a8a4
parent 0 95b198f216e5
equal deleted inserted replaced
5:79d62d1d7957 23:493788a4a8a4
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include <stringloader.h>
    20 #include <StringLoader.h>
    21 #include <aknglobalconfirmationquery.h>
    21 #include <AknGlobalConfirmationQuery.h>
    22 #include <avkon.hrh> // EAknSoftkeyNo
    22 #include <avkon.hrh> // EAknSoftkeyNo
    23 #include <aknglobalnote.h>
    23 #include <AknGlobalNote.h>
    24 
    24 
    25 #include <aknmediatorfacade.h>
    25 #include <AknMediatorFacade.h>
    26 #include <featmgr.h>
    26 #include <featmgr.h>
    27 #include <aknsddata.h>
    27 #include <aknSDData.h>
    28 #include <drmutility.rsg>
    28 #include <drmutility.rsg>
    29 
    29 
    30 #include "drmutilitysecondarydisplay.h"
    30 #include "drmutilitysecondarydisplay.h"
    31 #include "drmutilityinfonotewrapper.h"
    31 #include "DrmUtilityInfoNoteWrapper.h"
    32 
    32 
    33 // ============================= LOCAL FUNCTIONS ===============================
    33 // ============================= LOCAL FUNCTIONS ===============================
    34 
    34 
    35 // ============================ MEMBER FUNCTIONS ===============================
    35 // ============================ MEMBER FUNCTIONS ===============================
    36 
    36 
    38 // CDrmUtilityInfoNoteWrapper::CDrmUtilityInfoNoteWrapper
    38 // CDrmUtilityInfoNoteWrapper::CDrmUtilityInfoNoteWrapper
    39 // C++ default constructor can NOT contain any code, that
    39 // C++ default constructor can NOT contain any code, that
    40 // might leave.
    40 // might leave.
    41 // -----------------------------------------------------------------------------
    41 // -----------------------------------------------------------------------------
    42 //
    42 //
    43 DRM::CDrmUtilityInfoNoteWrapper::CDrmUtilityInfoNoteWrapper() 
    43 DRM::CDrmUtilityInfoNoteWrapper::CDrmUtilityInfoNoteWrapper()
    44     : CActive( EPriorityStandard )
    44     : CActive( EPriorityStandard )
    45     {
    45     {
    46     CActiveScheduler::Add( this );
    46     CActiveScheduler::Add( this );
    47     }
    47     }
    48 
    48 
    61 // Two-phased constructor.
    61 // Two-phased constructor.
    62 // -----------------------------------------------------------------------------
    62 // -----------------------------------------------------------------------------
    63 //
    63 //
    64 DRM::CDrmUtilityInfoNoteWrapper* DRM::CDrmUtilityInfoNoteWrapper::NewLC()
    64 DRM::CDrmUtilityInfoNoteWrapper* DRM::CDrmUtilityInfoNoteWrapper::NewLC()
    65     {
    65     {
    66     DRM::CDrmUtilityInfoNoteWrapper* self( 
    66     DRM::CDrmUtilityInfoNoteWrapper* self(
    67                                 new (ELeave) CDrmUtilityInfoNoteWrapper() );
    67                                 new (ELeave) CDrmUtilityInfoNoteWrapper() );
    68     CleanupStack::PushL( self );
    68     CleanupStack::PushL( self );
    69     self->ConstructL();
    69     self->ConstructL();
    70     return self;
    70     return self;
    71     }
    71     }
    80     DRM::CDrmUtilityInfoNoteWrapper* self( NewLC() );
    80     DRM::CDrmUtilityInfoNoteWrapper* self( NewLC() );
    81     CleanupStack::Pop( self );
    81     CleanupStack::Pop( self );
    82     return self;
    82     return self;
    83     }
    83     }
    84 
    84 
    85     
    85 
    86 // Destructor
    86 // Destructor
    87 DRM::CDrmUtilityInfoNoteWrapper::~CDrmUtilityInfoNoteWrapper()
    87 DRM::CDrmUtilityInfoNoteWrapper::~CDrmUtilityInfoNoteWrapper()
    88     {
    88     {
    89     Cancel(); // Cancel active object
    89     Cancel(); // Cancel active object
    90     delete iNote;
    90     delete iNote;
    93 
    93 
    94 // -----------------------------------------------------------------------------
    94 // -----------------------------------------------------------------------------
    95 // CDrmUtilityInfoNoteWrapper::ShowNoteL
    95 // CDrmUtilityInfoNoteWrapper::ShowNoteL
    96 // -----------------------------------------------------------------------------
    96 // -----------------------------------------------------------------------------
    97 //
    97 //
    98 void DRM::CDrmUtilityInfoNoteWrapper::ShowNoteL( TAknGlobalNoteType aType , 
    98 void DRM::CDrmUtilityInfoNoteWrapper::ShowNoteL( TAknGlobalNoteType aType ,
    99                                                  const TDesC& aNoteText,
    99                                                  const TDesC& aNoteText,
   100                                                  TInt aResourceId,
   100                                                  TInt aResourceId,
   101                                                  const TDesC& aString,
   101                                                  const TDesC& aString,
   102                                                  TInt aValue )
   102                                                  TInt aValue )
   103     {
   103     {
   104     RProcess myProcess;
   104     RProcess myProcess;
   105     TUid myProcessUid( KNullUid );
   105     TUid myProcessUid( KNullUid );
   106         
   106 
   107     // Convert primary display resource ID to Cover Ui
   107     // Convert primary display resource ID to Cover Ui
   108     // do nothing if not found 
   108     // do nothing if not found
   109     if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) &&
   109     if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) &&
   110          EvaluateCoverResourceId( aResourceId ) )
   110          EvaluateCoverResourceId( aResourceId ) )
   111         {  
   111         {
   112         RThread().Process( myProcess );
   112         RThread().Process( myProcess );
   113         myProcessUid = myProcess.Identity();             
   113         myProcessUid = myProcess.Identity();
   114             
   114 
   115         TUtilitySDData utilityData;
   115         TUtilitySDData utilityData;
   116         // First field is DrmUtility's Uid
   116         // First field is DrmUtility's Uid
   117         utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility;
   117         utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility;
   118         // ProcessId which uses DrmUtility
   118         // ProcessId which uses DrmUtility
   119         utilityData.iHandlerProcessId = myProcessUid; 
   119         utilityData.iHandlerProcessId = myProcessUid;
   120         if ( aNoteText.Compare( KNullDesC ) )
   120         if ( aNoteText.Compare( KNullDesC ) )
   121             {
   121             {
   122             // If there is filename given, it's always in the PrimaryString
   122             // If there is filename given, it's always in the PrimaryString
   123             utilityData.iStringParam.Append( aString );
   123             utilityData.iStringParam.Append( aString );
   124             }
   124             }
   125         if ( aValue > -1 )
   125         if ( aValue > -1 )
   126             {
   126             {
   127             // If there is filename given, it's always in the PrimaryString
   127             // If there is filename given, it's always in the PrimaryString
   128             utilityData.iStringParam.Append( aValue );
   128             utilityData.iStringParam.Append( aValue );
   129             }            
   129             }
   130 
   130 
   131         TUtilitySDDataPckg pckg( utilityData );                   
   131         TUtilitySDDataPckg pckg( utilityData );
   132         CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility, 
   132         CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility,
   133                                           aResourceId, 
   133                                           aResourceId,
   134                                           pckg ) );
   134                                           pckg ) );
   135         iNote->SetSecondaryDisplayData( sd ); // ownership to notifier client          
   135         iNote->SetSecondaryDisplayData( sd ); // ownership to notifier client
   136         }
   136         }
   137 
   137 
   138     iNote->ShowNoteL( iStatus , aType , aNoteText );
   138     iNote->ShowNoteL( iStatus , aType , aNoteText );
   139     SetActive();
   139     SetActive();
   140     }
   140     }
   156     }
   156     }
   157 
   157 
   158 // ---------------------------------------------------------
   158 // ---------------------------------------------------------
   159 // CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId
   159 // CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId
   160 // ---------------------------------------------------------
   160 // ---------------------------------------------------------
   161 //     
   161 //
   162 TBool DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( 
   162 TBool DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId(
   163     TInt& aResourceId )
   163     TInt& aResourceId )
   164     { 
   164     {
   165     switch ( aResourceId )
   165     switch ( aResourceId )
   166         {
   166         {
   167         case R_DRMUTILITY_CONFIRMATION_QUERY:
   167         case R_DRMUTILITY_CONFIRMATION_QUERY:
   168             {
   168             {
   169             aResourceId = ECover_confirmation_query;
   169             aResourceId = ECover_confirmation_query;
   384             {
   384             {
   385             aResourceId = ECover_automated_cd_expired;
   385             aResourceId = ECover_automated_cd_expired;
   386             }
   386             }
   387             break;
   387             break;
   388         */
   388         */
   389         
   389 
   390 #ifdef RD_DRM_PREVIEW_RIGHT_FOR_AUDIO        
   390 #ifdef RD_DRM_PREVIEW_RIGHT_FOR_AUDIO
   391         
   391 
   392         case R_DRMUTILITY_PREV_AUDIO_GET_LIST_QUERY:
   392         case R_DRMUTILITY_PREV_AUDIO_GET_LIST_QUERY:
   393             {
   393             {
   394             aResourceId = ECover_prev_audio_get_list_query;
   394             aResourceId = ECover_prev_audio_get_list_query;
   395             }
   395             }
   396             break;
   396             break;
   427         case R_DRMUTILITY_VIDEO_PREV_PLAY_LIST:
   427         case R_DRMUTILITY_VIDEO_PREV_PLAY_LIST:
   428             {
   428             {
   429             aResourceId = ECover_video_prev_play_list;
   429             aResourceId = ECover_video_prev_play_list;
   430             }
   430             }
   431             break;
   431             break;
   432             
   432 
   433 #endif // RD_DRM_PREVIEW_RIGHT_FOR_AUDIO
   433 #endif // RD_DRM_PREVIEW_RIGHT_FOR_AUDIO
   434             
   434 
   435         default:
   435         default:
   436             return EFalse; // No proper dialog found, skipping
   436             return EFalse; // No proper dialog found, skipping
   437         }    
   437         }
   438     return ETrue; // Dialog found
   438     return ETrue; // Dialog found
   439     }
   439     }
   440 
   440 
   441 //  End of File  
   441 //  End of File