profilesservices/MediaFileList/Inc/mediafileprotection.h
changeset 68 13e71d907dc3
parent 0 8c5d936e5675
child 51 8bda91a87a00
equal deleted inserted replaced
40:6465d5bb863a 68:13e71d907dc3
       
     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:   Class used to check the protection of the 
       
    15 *                media files.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MEDIAFILEPROTECTION_H
       
    22 #define MEDIAFILEPROTECTION_H
       
    23 
       
    24 #include "mediafiledialogutils.h"
       
    25 #include "mediafilevariation.h"
       
    26 
       
    27 //  INCLUDES
       
    28 
       
    29 #include <e32base.h>
       
    30 #include <DRMHelper.h>
       
    31 #include <apgcli.h>   // RApaLsSession
       
    32 
       
    33 
       
    34 // CONSTANTS
       
    35 
       
    36 
       
    37 //	FORWARD DECLARATIONS
       
    38 
       
    39 
       
    40 
       
    41 /**
       
    42 * CMFProtectionHandler
       
    43 * 
       
    44 * For gettting media file protection information (eg drm protection).
       
    45 * If media is protected and does not have necessary rights it cannot
       
    46 * be used eg as ringing tone. 
       
    47 *
       
    48 */
       
    49 NONSHARABLE_CLASS (CMFProtectionHandler) : public CBase
       
    50     {
       
    51     public:
       
    52     // enumeration which tells what is the file used for.
       
    53     enum TIntention
       
    54         {
       
    55         EPlay,
       
    56         ESelect
       
    57         };
       
    58     
       
    59     public:// Constructors and destructor
       
    60 
       
    61         /**
       
    62         * Two-phased constructor.
       
    63         */
       
    64 		static CMFProtectionHandler* NewL();
       
    65         
       
    66         /**
       
    67         * Destructor.
       
    68         */
       
    69         virtual ~CMFProtectionHandler();
       
    70     
       
    71     private:
       
    72 
       
    73         /**
       
    74         * C++ default constructor.
       
    75         */
       
    76         CMFProtectionHandler();
       
    77 	
       
    78         /**
       
    79         * By default Symbian OS constructor is private.
       
    80         */
       
    81         void ConstructL();
       
    82 
       
    83     public: // Functions from base classes
       
    84 
       
    85         /**
       
    86         * Checks if an unprotected file is valid.
       
    87         * @param aFileName Full path and filename.
       
    88         * @param aIntention Describes what the file is used for.
       
    89         * @return ETrue if the file is valid for intended use.
       
    90         */
       
    91         TBool IsFileValidL( const TDesC& aFileName, TIntention aIntention );
       
    92         TBool IsFileValid( const TDesC& aFileName, TIntention aIntention );
       
    93         TBool IsVideoValidL( const TDesC& aFileName, TIntention aIntention );
       
    94         TBool IsVideoValid( const TDesC& aFileName, TIntention aIntention );
       
    95 
       
    96         void SetAttrL( TInt aAttr, TInt aValue );
       
    97         void SetAttrL( TInt aAttr, const TDesC& aValue );
       
    98         
       
    99 
       
   100     private:
       
   101         /**
       
   102         * Return media file type
       
   103         */
       
   104         //TInt32 MediaFileType( const TDesC& aFileName );
       
   105 
       
   106         /**
       
   107         * Set the automated content type
       
   108         * @param  aAutomatedType: type of automated content
       
   109         */
       
   110         void SetAutomatedType(
       
   111              CDRMHelper::TDRMHelperAutomatedType aAutomatedType );
       
   112 
       
   113     private:
       
   114 
       
   115         /**
       
   116         * Displays an error note.
       
   117         * @param @aResourceId Resource ID
       
   118         */
       
   119         void ShowErrorNoteL( TInt aResourceId );
       
   120 
       
   121         /**
       
   122         * Checks if an unprotected file is valid.
       
   123         * @param aFileName Full path and filename.
       
   124         * @param aIntention Describes what the file is used for.
       
   125         * @return ETrue if the file is valid for intended use.
       
   126         */
       
   127         TBool IsFileValidUnprotectedL(
       
   128               const TDesC& aFileName, TIntention aIntention );
       
   129 
       
   130         /**
       
   131         * Returns info whether demoplay is allowed for given filetype
       
   132         * @param aDataType Tone MIME type
       
   133         * @return ETrue if tone allowed to be played
       
   134         */
       
   135         //TBool AllowDemoPlay( const TDesC& aDataType );
       
   136 
       
   137         /**
       
   138         * Returns info whether given filetype is allowed as ringingtone
       
   139         * @param aDataType Tone MIME type
       
   140         * @return ETrue if tone is allowed to be selected
       
   141         */
       
   142         //TBool AllowSelect( const TDesC& aDataType ) const;
       
   143 
       
   144         /**
       
   145         * Finds out the MIME type of a given file
       
   146         * @param aFileName File to be checked
       
   147         * @return Returns datatype of a file
       
   148         */
       
   149         TDataType DataTypeL( const TDesC& aFileName );
       
   150         
       
   151         /**
       
   152         * Finds out DRM restrictions for a given file
       
   153         * @param aFileName File to be checked
       
   154         * @param aInfoBits(out) Determines CFM protection
       
   155         * @return Returns EFalse if file is corrupted or has no rights
       
   156         */
       
   157         TBool GetFileInfoL( const TDesC& aFileName, TInt32& aInfoBits );
       
   158 
       
   159         /**
       
   160         * Checks if file is WMDRM protected.
       
   161         * @param aFileName Name of the file to be checked.
       
   162         * @return ETrue if file is WMDRM protected, EFalse otherwise.
       
   163         */
       
   164         TBool   IsFileWMDRMProtectedL( const TDesC& aFileName );
       
   165         
       
   166         TBool CheckFileSize( const TDesC& aFile, const TDesC& aMimeType );
       
   167 
       
   168 
       
   169     private:
       
   170         // DRM common functions
       
   171         DRMCommon* iDRMCommon;
       
   172 
       
   173         // DRM helper
       
   174         CDRMHelper* iDRMHelper;
       
   175         
       
   176         // for finding out drive type (eg memory card)
       
   177         CDriveUtil* iDriveUtil;
       
   178         
       
   179         // for media file list variation
       
   180         CMediaFileDialogVariation* iVariation;
       
   181           
       
   182         // Automated content type
       
   183         CDRMHelper::TDRMHelperAutomatedType iAutomatedType;
       
   184         
       
   185         // max file size
       
   186         TInt iMaxFileSize;
       
   187         
       
   188         // excluded mime types 
       
   189         CMimeTypeList* iExcludedMimeTypes;
       
   190         
       
   191         RApaLsSession iApaLsSession;
       
   192         RFs iFsSession;
       
   193 
       
   194     };
       
   195     
       
   196 
       
   197     
       
   198 
       
   199 
       
   200 #endif  // MEDIAFILEPROTECTION_H
       
   201 
       
   202 // End of File