videocollection/mpxmyvideoscollection/inc/vcxmyvideosasyncfileoperations.h
changeset 15 cf5481c2bc0b
parent 0 96612d01cf9f
equal deleted inserted replaced
2:dec420019252 15:cf5481c2bc0b
    25 #include <mpxcollectionplugin.h>
    25 #include <mpxcollectionplugin.h>
    26 #include <mpxcollectionpath.h>
    26 #include <mpxcollectionpath.h>
    27 #include <mpxcollectionmessagedefs.h>
    27 #include <mpxcollectionmessagedefs.h>
    28 #include <vcxmyvideosdefs.h>
    28 #include <vcxmyvideosdefs.h>
    29 
    29 
    30 //#include "mpxdbactivetask.h" // change to <> when moved to s60 dir and remove temp .h-file
       
    31 
       
    32 #include "vcxmyvideosdownloadutil.h"
       
    33 
       
    34 // FORWARD DECLARATIONS
    30 // FORWARD DECLARATIONS
    35 class CVcxMyVideosCollectionPlugin;
    31 class CVcxMyVideosCollectionPlugin;
       
    32 class CVcxMyVideosAsyncFileCopy;
    36 
    33 
    37 // CONSTANTS
    34 // CONSTANTS
    38 
    35 
    39 // CLASS DECLARATION
    36 // CLASS DECLARATION
    40 
    37 
    81         void DeleteVideoL( TUint32 aMdsId, TBool aForce = EFalse );
    78         void DeleteVideoL( TUint32 aMdsId, TBool aForce = EFalse );
    82                 
    79                 
    83         /**
    80         /**
    84         * Performs one Move or Copy operation. Called by HandleStep.
    81         * Performs one Move or Copy operation. Called by HandleStep.
    85         *
    82         *
    86         * @return ETrue if operation was the last one, EFalse othewise.
    83         * @return MVcxMyVideosActiveTaskObserver::EDone if was last operation,
    87         */
    84         *         MVcxMyVideosActiveTaskObserver::EMoreToCome otherwise.
    88         TBool HandleMoveOrCopyStepL();
    85         */
       
    86         MVcxMyVideosActiveTaskObserver::TStepResult HandleMoveOrCopyStepL();
    89 
    87 
    90         /**
    88         /**
    91         * Moves or copies video to another drive.
    89         * Moves or copies video to another drive.
    92         *
    90         *
    93         * @param aMdsId        MDS id of the item to be moved.
    91         * @param aMdsId        MDS id of the item to be moved.
    94         * @param aTargetDrive  Target drive.
       
    95         * @param aMove         If ETrue, the source file is deleted.
    92         * @param aMove         If ETrue, the source file is deleted.
    96         */
    93         */
    97         void MoveOrCopyVideoL( TUint32 aMdsId, TInt aTargetDrive, TBool aMove );
    94         void MoveOrCopyVideoL( TUint32 aMdsId );
    98                        
    95                        
    99         /**
    96         /**
   100         * Generates and sends resp message for Move,Copy and Delete operations.
    97         * Generates and sends resp message for Move,Copy and Delete operations.
   101         * Does nothing if there is some other operation going on.
    98         * Does nothing if there is some other operation going on.
   102         * This function is called when operation is interrupted from a leave or
    99         * This function is called when operation is interrupted from a leave or
   108         void CancelOperationL( TInt aErr );
   105         void CancelOperationL( TInt aErr );
   109  
   106  
   110         /**
   107         /**
   111         * Performs one Delete operation. Called by HandleStep.
   108         * Performs one Delete operation. Called by HandleStep.
   112         *
   109         *
   113         * @return ETrue if operation was the last one, EFalse otherwise.
   110         * @return MVcxMyVideosActiveTaskObserver::EDone if was last operation,
   114         */
   111         *         MVcxMyVideosActiveTaskObserver::EMoreToCome otherwise.
   115         TBool HandleDeleteStepL();
   112         */
       
   113         MVcxMyVideosActiveTaskObserver::TStepResult HandleDeleteStepL();
   116 
   114 
   117     private:
   115     private:
   118         
   116         
   119         /**
   117         /**
   120         * Called when file is going to be moved or copied to aDrive.
   118         * Called when file is going to be moved or copied to aDrive.
   141         * @param aTargetDrive Target drive.
   139         * @param aTargetDrive Target drive.
   142         */
   140         */
   143         void GenerateTargetPathForMoveOrCopyL(
   141         void GenerateTargetPathForMoveOrCopyL(
   144                 const TDesC& aSourcePath, TDes& aTargetPath, TInt aTargetDrive );
   142                 const TDesC& aSourcePath, TDes& aTargetPath, TInt aTargetDrive );
   145 
   143 
       
   144         /**
       
   145         * Initializes member variables for the Copy or Move operations.
       
   146         *
       
   147         * @param aCmd  Command received from collection client.
       
   148         */                
       
   149         void InitMoveOrCopyOperationsL( CMPXMedia& aCmd );
       
   150         
       
   151         /**
       
   152         * Called when file copying completes in Move or Copy operations.
       
   153         *
       
   154         * @param aErr Result code of the file copy.
       
   155         */
       
   156         void HandleFileCopyCompletedL( TInt aErr );
       
   157         
       
   158         /**
       
   159         * Initializes MDS and collection cache before the actual file copy.
       
   160         * Does some sanity checks also.
       
   161         *
       
   162         * @param aMdsId        MDS ID of the video being moved/copied.
       
   163         */
       
   164         void InitSingleMoveOrCopyL( TUint32 aMdsId );
       
   165 
   146     public:
   166     public:
   147 
   167 
   148         /**
   168         /**
   149         * Array containing item ids which are being moved/copied or deleted.
   169         * Array containing item ids which are being moved/copied or deleted.
   150         */
   170         */
   172         * Target drive for Move or Copy operation.
   192         * Target drive for Move or Copy operation.
   173         */
   193         */
   174         TInt iTargetDrive;
   194         TInt iTargetDrive;
   175 
   195 
   176         /**
   196         /**
       
   197         * Set to ETrue if current operation is Move.
       
   198         */
       
   199         TBool IsMoveOperation;
       
   200         
       
   201         /**
   177         * Owner of this class.
   202         * Owner of this class.
   178         */
   203         */
   179         CVcxMyVideosCollectionPlugin& iCollection;
   204         CVcxMyVideosCollectionPlugin& iCollection;
       
   205         
       
   206         /**
       
   207         * Performs single file copy in multiple steps.
       
   208         * Used to avoid long blockings when copying large files.
       
   209         * Own.
       
   210         */
       
   211         CVcxMyVideosAsyncFileCopy* iFileCopier;
       
   212         
       
   213         /**
       
   214         * New media which is created to collection cache in copy operation.
       
   215         * It is stored in memeber variable in case that file operations
       
   216         * fail and we have to roll MDS and cache back. Own.
       
   217         */
       
   218         CMPXMedia* iMediaForCopyOp;
       
   219         
       
   220         /**
       
   221         * Updated media which is changed in move operation.
       
   222         * It is stored in memeber variable in case that file operations
       
   223         * fail and we have to roll MDS and cache back. Own.
       
   224         */        
       
   225         CMPXMedia* iMediaForMoveOp;
       
   226         
       
   227         /**
       
   228         * Source path for move or copy operation.
       
   229         */
       
   230         TFileName iSourcePath;
       
   231         
       
   232         /**
       
   233         * Target path for move or copy operation.
       
   234         */
       
   235         TFileName iTargetPath;
       
   236         
       
   237         /**
       
   238         * Flag for move operation is stored just to avoid accessing
       
   239         * CMPXMedia object too much.
       
   240         */
       
   241         TBool iIsMoveOperation;
   180                                 
   242                                 
   181     };
   243     };
   182 
   244 
   183 #endif   // VCXMYVIDEOSASYNCFILEOPERATIONS_H
   245 #endif   // VCXMYVIDEOSASYNCFILEOPERATIONS_H
   184 
   246