profilesservices/FileList/Src/CFLDDRMImplementation.h
branchRCL_3
changeset 24 8ee96d21d9bf
parent 23 8bda91a87a00
child 25 7e0eff37aedb
equal deleted inserted replaced
23:8bda91a87a00 24:8ee96d21d9bf
     1 /*
       
     2 * Copyright (c) 2002 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:  Implementation for DRM functionality.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CFLDDRMIMPLEMENTATION_H
       
    21 #define CFLDDRMIMPLEMENTATION_H
       
    22 
       
    23 // INTERNAL INCLUDES
       
    24 #include "MFLDFileObserver.h"
       
    25 
       
    26 // EXTERNAL
       
    27 #include <e32base.h>
       
    28 #include <apmstd.h> // KMaxDataTypeLength
       
    29 #include <data_caging_path_literals.hrh>
       
    30 #include <centralrepository.h>
       
    31 #include <DRMHelper.h>	// For TDRMHelperAutomatedType
       
    32 #include <DRMRights.h>	// For TRestriction
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class DRMCommon;
       
    36 class CDRMHelper;
       
    37 class CFLDFileListModel;
       
    38 class MProfilesLocalFeatures;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 *  Implementation for DRM functionality.
       
    44 *
       
    45 *  @lib filelist.lib
       
    46 *  @since 2.1
       
    47 */
       
    48 NONSHARABLE_CLASS( CFLDDRMImplementation ) : public CBase, public MFLDFileObserver
       
    49     {
       
    50     public:  // Constructors and destructor
       
    51 
       
    52         /**
       
    53         * Two-phased constructor.
       
    54         */
       
    55         static CFLDDRMImplementation* NewL( CFLDFileListModel* aModel );
       
    56 
       
    57         /**
       
    58         * Destructor.
       
    59         */
       
    60         virtual ~CFLDDRMImplementation();
       
    61 
       
    62     public: // Functions from base classes
       
    63 
       
    64         /**
       
    65         * From MFLDFileObserver.
       
    66         */
       
    67 		TBool IsFileValidL( const TDesC& aFileName, TIntention aIntention );
       
    68 
       
    69 		/**
       
    70 		* From MFLDFileObserver.
       
    71 		*/
       
    72 		TInt32 MediaFileType( const TDesC& aFileName ) const;
       
    73 
       
    74 	public:	// New functions
       
    75 
       
    76 		/**
       
    77         * Set the automated content type
       
    78         * @param  aAutomatedType: type of automated content
       
    79         */
       
    80         void SetAutomatedType(
       
    81          CDRMHelper::TDRMHelperAutomatedType aAutomatedType );
       
    82 
       
    83 
       
    84     private: // New functions
       
    85 
       
    86         /**
       
    87         * Displays an error note.
       
    88         * @since 2.1
       
    89         * @param @aResourceId Resource ID for a TBUF resource containing the error text.
       
    90         */
       
    91         void ShowErrorNoteL( TInt aResourceId ) const;
       
    92 
       
    93         /**
       
    94         * Checks if an unprotected file is valid.
       
    95         * @param aFileName Full path and filename.
       
    96         * @param aIntention Describes what is the file used for.
       
    97         * @return Returns ETrue if the file is valid for intended use.
       
    98         */
       
    99         TBool IsFileValidUnprotectedL(
       
   100             const TDesC& aFileName, TIntention aIntention ) const;
       
   101 
       
   102 		/**
       
   103 		* Returns info whether demoplay is allowed for given filetype
       
   104 		* @param aDataType Tone MIME type
       
   105 		* @return ETrue if tone allowed to be played
       
   106 		*/
       
   107 		TBool AllowDemoPlay( const TDesC& aDataType ) const;
       
   108 
       
   109 		/**
       
   110 		* Returns info whether given filetype is allowed as ringingtone
       
   111 		* @param aDataType Tone MIME type
       
   112 		* @return ETrue if tone is allowed to be selected
       
   113 		*/
       
   114 		TBool AllowSelect( const TDesC& aDataType ) const;
       
   115 
       
   116 		/**
       
   117 		* Finds out the MIME type of a given file
       
   118 		* @param aFileName File to be checked
       
   119 		* @return Returns datatype of a file
       
   120 		*/
       
   121 		TDataType DataTypeL( const TDesC& aFileName ) const;
       
   122 		
       
   123 		/**
       
   124 		* Finds out DRM restrictions for a given file
       
   125 		* @param aFileName File to be checked
       
   126 		* @param aInfoBits(out) Determines CFM protection
       
   127 		* @return Returns EFalse if file is corrupted or has no rights
       
   128 		*/
       
   129 		TBool GetFileInfoL( const TDesC& aFileName,
       
   130 		 TInt32& aInfoBits ) const;
       
   131 
       
   132 		/**
       
   133          * Checks if file is WMDRM protected.
       
   134          * @param aFileName Name of the file to be checked.
       
   135          * @return ETrue if file is WMDRM protected, EFalse otherwise.
       
   136          */
       
   137 		TBool	IsFileWMDRMProtectedL( const TDesC& aFileName ) const;
       
   138 
       
   139     private:
       
   140 
       
   141         /**
       
   142         * C++ default constructor.
       
   143         */
       
   144         CFLDDRMImplementation( CFLDFileListModel* aModel );
       
   145 
       
   146         /**
       
   147         * By default Symbian 2nd phase constructor is private.
       
   148         */
       
   149         void ConstructL();
       
   150 
       
   151     private:    // Data
       
   152 
       
   153         /// Own: DRM common functions
       
   154         DRMCommon* iDRMCommon;
       
   155 
       
   156         /// Own: DRM helper
       
   157         CDRMHelper* iDRMHelper;
       
   158 
       
   159         /// Not owned: FileList model
       
   160         CFLDFileListModel* iModel;
       
   161 
       
   162         /// Automated content type
       
   163         CDRMHelper::TDRMHelperAutomatedType iAutomatedType;
       
   164 
       
   165         /// Not owned: Profiles local features
       
   166         MProfilesLocalFeatures* iProfilesFeatures;
       
   167     };
       
   168 
       
   169 #endif      // CFLDDRMIMPLEMENTATION_H
       
   170 
       
   171 // End of File