sl@0: /* sl@0: * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @test sl@0: @internalComponent sl@0: sl@0: This contains CT_FileManData sl@0: */ sl@0: sl@0: #if (!defined __T_FILEMAN_DATA_H__) sl@0: #define __T_FILEMAN_DATA_H__ sl@0: sl@0: // User Includes sl@0: #include "DataWrapperBase.h" sl@0: #include "FileserverUtil.h" sl@0: sl@0: // EPOC includes sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: struct THistoryData sl@0: { sl@0: TFileName iCurrentSource; sl@0: TFileName iCurrentTarget; sl@0: TEntry iCurrentEntry; sl@0: TInt iBytesTransferred; sl@0: CFileMan::TAction iCurrentAction; sl@0: TFileManError iMoreInfoAboutError; sl@0: TInt iLastError; sl@0: TPtrC iFullPath; sl@0: TPtrC iAbbreviatedPath; sl@0: }; sl@0: enum TObserverNotifyType sl@0: { sl@0: ENotifyStarted, sl@0: ENotifyOperation, sl@0: ENotifyEnded, sl@0: ENotifyUnknown sl@0: }; sl@0: sl@0: class CT_FileManData: public CDataWrapperBase, public MFileManObserver sl@0: { sl@0: public: sl@0: static CT_FileManData* NewL(); sl@0: ~CT_FileManData(); sl@0: sl@0: virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); sl@0: virtual TAny* GetObject(); sl@0: sl@0: protected: sl@0: CT_FileManData(); sl@0: void ConstructL(); sl@0: sl@0: void RunL(CActive* aActive, TInt aIndex); sl@0: void DoCancel(CActive* aActive, TInt aIndex); sl@0: sl@0: private: sl@0: inline void DoCmdNewL(const TDesC& aSection); sl@0: inline void DoCmdAttribsL(const TDesC& aSection, const TInt aAsyncErrorIndex); sl@0: inline void DoCmdCopyL(const TDesC& aSection, const TInt aAsyncErrorIndex); sl@0: inline void DoCmdDeleteL(const TDesC& aSection, const TInt aAsyncErrorIndex); sl@0: inline void DoCmdMoveL(const TDesC& aSection, const TInt aAsyncErrorIndex); sl@0: inline void DoCmdRenameL(const TDesC& aSection, const TInt aAsyncErrorIndex); sl@0: inline void DoCmdRmDirL(const TDesC& aSection, const TInt aAsyncErrorIndex); sl@0: inline void DoCmdSetObserver(); sl@0: sl@0: inline void DoCmdCurrentAction(const TDesC& aSection); sl@0: inline void DoCmdGetCurrentTarget(const TDesC& aSection); sl@0: inline void DoCmdGetCurrentSource(const TDesC& aSection); sl@0: inline void DoCmdBytesTransferredByCopyStep(const TDesC& aSection); sl@0: inline void DoCmdCurrentEntryL(const TDesC& aSection); sl@0: inline void DoCmdAbbreviatedPath(const TDesC& aSection); sl@0: inline void DoCmdFullPath(const TDesC& aSection); sl@0: inline void DoCmdGetLastError(const TDesC& aSection); sl@0: inline void DoCmdGetMoreInfoAboutError(const TDesC& aSection); sl@0: inline void DoCleanup(); sl@0: sl@0: // MFileManObserver events sl@0: inline TControl NotifyFileManStarted(); sl@0: inline TControl NotifyFileManOperation(); sl@0: inline TControl NotifyFileManEnded(); sl@0: sl@0: // Helper functions for MFileManObserver Testing sl@0: void ReadTControl(const TDesC& aSection); sl@0: TBool GetTControlFromConfig(const TDesC& aParameterName, const TDesC& aSection, TControl& aFlag); sl@0: sl@0: // Helper function sl@0: TBool GetActionFromConfig(const TDesC& aParameterName, const TDesC& aSection, CFileMan::TAction& aAction); sl@0: TBool GetFileManErrorFromConfig(const TDesC& aParameterName, const TDesC& aSection, TFileManError& aError); sl@0: void ConvertFileManErrorToString(TFileManError& aError, TPtrC& aErrorStr); sl@0: void ConvertActionToString(CFileMan::TAction aAction, TPtrC& aActionStr); sl@0: TBool GetOperationFromConfig(const TDesC& aParameterName, const TDesC& aSection, TUint& aSwitch); sl@0: void ClearHistory(); sl@0: void CreateHistoryRecord(THistoryData& aRecord); sl@0: TBool GetNotifyType(const TDesC& aParameterName, const TDesC& aSection, TObserverNotifyType& aType); sl@0: RPointerArray* GetHistoryDataByType(const TDesC& aSection); sl@0: sl@0: private: sl@0: //** CFileMan class instance that is tested */ sl@0: CFileMan* iFileMan; sl@0: sl@0: /** Sores aAsyncErrorIndex (Only For MFileObserver notifications). */ sl@0: TInt iAsyncErrorIndex; sl@0: sl@0: /** Indicates if functions called asynchronouslly (Only For MFileObserver notifications). */ sl@0: TBool iAsyncCall; sl@0: sl@0: /** MFileManObserver class instance */ sl@0: MFileManObserver* iFileManObserver; sl@0: sl@0: /** The request status for disk space events */ sl@0: RPointerArray iAttribs; sl@0: sl@0: /** The request status for disk space events */ sl@0: RPointerArray iCopy; sl@0: sl@0: /** The request status for disk space events */ sl@0: RPointerArray iDelete; sl@0: sl@0: /** The request status for disk space events */ sl@0: RPointerArray iMove; sl@0: sl@0: /** The request status for disk space events */ sl@0: RPointerArray iRename; sl@0: sl@0: /** The request status for disk space events */ sl@0: RPointerArray iRmDir; sl@0: sl@0: /** Stores history for NotifyFileManStarted */ sl@0: RPointerArray iStartedHistory; sl@0: sl@0: /** Stores history for NotifyFileManOperation */ sl@0: RPointerArray iOperationHistory; sl@0: sl@0: /** Stores history for NotifyFileManEnded */ sl@0: RPointerArray iEndedHistory; sl@0: sl@0: /** Stores return value for MFileManObserver Notifications */ sl@0: TControl iTControl; sl@0: sl@0: /** Stores source of filename for which return specified TControl value. */ sl@0: TFileName iNotifyFileName; sl@0: sl@0: /** Stores name of Notify Function. */ sl@0: TObserverNotifyType iObserverNotifyType; sl@0: sl@0: /** Idicates if we need to use specified TControl value in notifications. */ sl@0: TBool iUseTControl; sl@0: sl@0: }; sl@0: sl@0: #endif /* __T_FILEMAN_DATA_H__ */