creator/engine/inc/creator_file.h
branchRCL_3
changeset 21 b3cee849fa46
equal deleted inserted replaced
20:48060abbbeaf 21:b3cee849fa46
       
     1 /*
       
     2 * Copyright (c) 2010 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef __CREATORFiles_H__
       
    23 #define __CREATORFiles_H__
       
    24 
       
    25 #include "engine.h"
       
    26 #include "creator_modulebase.h"
       
    27 
       
    28 #include <caf/caf.h>
       
    29 using namespace ContentAccess;
       
    30 
       
    31 #include <e32base.h>
       
    32 #include <bautils.h>
       
    33 #include <pathinfo.h>
       
    34 #include <apgcli.h> // RApaLsSession
       
    35 
       
    36 class CCreatorEngine;
       
    37 class CFilesParameters;
       
    38 class CDRMPermission;
       
    39 class CDRMConstraint;
       
    40 
       
    41 class CCreatorFiles : public CCreatorModuleBase
       
    42     {
       
    43 enum TCreatorFilesState{
       
    44     ECreatorFilesDelete,
       
    45     ECreatorFilesStart,
       
    46     ECreatorFilesGetDirectory,
       
    47     ECreatorFilesAskDRMData,
       
    48     ECreatorFilesAskDRM_CD_Counts,
       
    49     ECreatorFilesAskDRM_CD_Minutes
       
    50 };
       
    51 public: 
       
    52     static CCreatorFiles* NewL(CCreatorEngine* aEngine);
       
    53     static CCreatorFiles* NewLC(CCreatorEngine* aEngine);
       
    54     ~CCreatorFiles();
       
    55 
       
    56 private:
       
    57     CCreatorFiles();
       
    58     void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase
       
    59 
       
    60 public:
       
    61     TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
       
    62     void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData); //from MUIObserver
       
    63     TInt CreateFileEntryL(CFilesParameters *aParameters, TInt aCommand);    
       
    64     void DeleteAllL();
       
    65     void DeleteAllCreatedByCreatorL();
       
    66 
       
    67 private:
       
    68     
       
    69     void EncryptFileL( const TDesC& aFileName, const TDesC& aOutFileName, CFilesParameters *aParameters );
       
    70     void SetPermissionsL( CMetaDataArray* aMetaData, const TDesC& aOutFileName, CFilesParameters *aParameters );
       
    71     void SetMimeTypeL( const TDesC& aFileName, TDes8& aMime, CFilesParameters *aParameters );
       
    72     TBool AskDRMDataFromUserL();
       
    73     void StorePathsForDeleteL( CDesCArray& aPaths );
       
    74     void GenerateFileNameL( TFileName& aRootName );
       
    75     
       
    76 private:
       
    77     CFilesParameters* iParameters;
       
    78     CFilesParameters* iUserParameters;
       
    79     TFileName iDirectoryQueriedFromUser;
       
    80     RFs& iFs;
       
    81     RApaLsSession iApaLs;
       
    82     CDesCArray* iFilePaths;
       
    83     TInt iFileId;
       
    84 
       
    85 public:
       
    86     };
       
    87 
       
    88 
       
    89 class CFilesParameters : public CCreatorModuleBaseParameters
       
    90     {
       
    91 public: 
       
    92     HBufC*          iFullFilePath;
       
    93     TInt            iFileCommand;
       
    94     CDRMPermission* iPermission;
       
    95     TBool           iEncrypt;
       
    96     
       
    97 public:
       
    98     CFilesParameters();
       
    99     CFilesParameters( CFilesParameters& aCopy );
       
   100     ~CFilesParameters();
       
   101     };
       
   102 
       
   103 
       
   104 
       
   105 #endif // __CREATORFiles_H__