commondrm/drmutility/inc/drmutilityui.h
changeset 0 95b198f216e5
child 18 8a03a285ab14
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 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:  Provides operations for ui usage of DRM Utility API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CDRMUTILITYUI_H
       
    20 #define CDRMUTILITYUI_H
       
    21 
       
    22 //*** system include files go here:
       
    23 #include <e32base.h>
       
    24 #include <f32file.h>
       
    25 #include <aknnotifystd.h>
       
    26 
       
    27 //*** forward declarations go here:
       
    28 class CDRMConstraint;
       
    29 class CCoeEnv;
       
    30 class CStringResourceReader;
       
    31 class CEikDialog;
       
    32 class CAknResourceNoteDialog;
       
    33 class CMediatorEventProvider;
       
    34 
       
    35 namespace ContentAccess
       
    36     {
       
    37     class CData;
       
    38     }
       
    39 
       
    40 namespace DRM 
       
    41 {
       
    42     
       
    43     //*** forward declarations go here:
       
    44     class CDrmUtilityInfoNoteWrapper;
       
    45     
       
    46  /**
       
    47   *  Utility class for DRM utility related graphic functions
       
    48   *
       
    49   *  @lib drmutilitycommon.lib
       
    50   *  @since S60 v5.0
       
    51   */
       
    52 NONSHARABLE_CLASS( CDrmUtilityUI ) : public CBase
       
    53     {
       
    54 
       
    55 public:
       
    56 
       
    57     /**
       
    58      * Creates a new CDrmUtilityUI object and returns a pointer to it
       
    59      *
       
    60      * @return A functional CDrmUtilityUI -object
       
    61      * @leave System wide error code
       
    62      */	
       
    63     IMPORT_C static CDrmUtilityUI* NewL( CCoeEnv* aCoeEnv = NULL );
       
    64 
       
    65     /**
       
    66      * Creates a new CDrmUtilityUI object and returns a pointer to it
       
    67      * leaves the returned object to the cleanup stack
       
    68      *
       
    69      * @return A functional CDrmUtilityUI -object
       
    70      * @leave System wide error code
       
    71      */	
       
    72     IMPORT_C static CDrmUtilityUI* NewLC( CCoeEnv* aCoeEnv = NULL );
       
    73 
       
    74     /**
       
    75      * Destructor
       
    76      */
       
    77     virtual ~CDrmUtilityUI();
       
    78      
       
    79     /**
       
    80     * Display query dialog
       
    81     */
       
    82     IMPORT_C TInt DisplayQueryWithIdL( TInt aTextResourceId, 
       
    83                                        TInt aQueryResourceId );
       
    84     
       
    85     IMPORT_C TInt DisplayQueryWithIdValueL( TInt aTextResourceId, 
       
    86                                             TInt aQueryResourceId, 
       
    87                                             const TDesC& aString );
       
    88     
       
    89     IMPORT_C TInt DisplayQueryL( TInt aTextResourceId, TInt aValue );
       
    90     
       
    91     IMPORT_C TInt DisplayQueryL( TInt aTextResourceId, const TDesC& aString );
       
    92     
       
    93     IMPORT_C TInt DisplayQueryL( TInt aTextResourceId, 
       
    94         	                     const TDesC& aString, 
       
    95                                  TInt aValue,
       
    96         	                     TInt aStringPos = -1,
       
    97         	                     TInt aValuePos = -1 );
       
    98     
       
    99     IMPORT_C TInt DisplayQueryL( TDesC& aPromptText, TInt aQueryResourceId );
       
   100     
       
   101     IMPORT_C TInt SetAutomatedQueryL( CDRMConstraint* aConstraint );
       
   102 
       
   103    /**
       
   104     * Display note
       
   105     */
       
   106     IMPORT_C void ShowFutureRightsNoteL( CDRMConstraint* aConstraint );
       
   107 
       
   108     IMPORT_C void DisplayNoteL( TInt aTextResourceId );
       
   109     
       
   110     IMPORT_C void DisplayNoteL( TInt aTextResourceId, const TDesC& aString );
       
   111     
       
   112     IMPORT_C void DisplayNoteL( TInt aTextResourceId, TInt aValue );
       
   113     
       
   114     IMPORT_C void DisplayNoteL( TDesC& aPromptText, 
       
   115                                 TInt aResourceId, 
       
   116                                 const TDesC& aString = KNullDesC, 
       
   117                                 TInt aValue = -1 );   
       
   118                                 
       
   119    /**
       
   120     * Display list query
       
   121     */
       
   122     IMPORT_C TInt DisplayPopupWindowsForPreviewL( 
       
   123                                                 ContentAccess::CData& aContent,
       
   124                                                 TInt aPreviewType, 
       
   125                                                 TInt aMediaType );
       
   126 
       
   127 
       
   128 protected:
       
   129 
       
   130 private:
       
   131 
       
   132     CDrmUtilityUI( CCoeEnv* aCoeEnv );
       
   133 
       
   134     void ConstructL();
       
   135     
       
   136     CAknResourceNoteDialog* CreateNoteForResourceL( TInt aResId );
       
   137     
       
   138     TAknGlobalNoteType GlobalNoteTypeForResource( TInt aResId );
       
   139     
       
   140     TInt GetOmaStartTime( CDRMConstraint* aConstraint, TTime& aStartTime );
       
   141     
       
   142     TInt EvaluatePreviewMediaTypeL( ContentAccess::CData& aContent,
       
   143                                     TInt aPreviewType );
       
   144     
       
   145     void PrepareSecondaryDisplayL( CEikDialog& aDialog, 
       
   146                                    TInt aResourceId,
       
   147                                    const TDesC& aString = KNullDesC, 
       
   148                                    TInt aValue = -1 );
       
   149                                    
       
   150     void CancelSecondaryDisplayL( TInt aResourceId );
       
   151 
       
   152 
       
   153 private: // Data members
       
   154 
       
   155     // Control environment, not owned
       
   156     CCoeEnv* iCoeEnv;
       
   157     
       
   158     // Paths of the resource files
       
   159     HBufC* iUtilityResourceFile;
       
   160     HBufC* iAvkonResourceFile;
       
   161 
       
   162     // Resource offsets in CoeEnv, when it is available
       
   163     TInt iUtilityResourceFileOffset;
       
   164     TInt iAvkonResourceFileOffset;
       
   165 
       
   166     // Used to read resources when CoeEnv is not available
       
   167     CStringResourceReader* iUtilityStringResourceReader;
       
   168     CStringResourceReader* iAvkonStringResourceReader;
       
   169     
       
   170     // File server
       
   171     RFs iFs;
       
   172     
       
   173     // Used to queue up global notes
       
   174     RPointerArray<CDrmUtilityInfoNoteWrapper> iNoteList;
       
   175 
       
   176     CMediatorEventProvider* iEventProvider;
       
   177 
       
   178     };
       
   179 }
       
   180 
       
   181 #endif // CDRMUTILITYUI_H