|
1 /* |
|
2 * Copyright (c) 2008 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 the License "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 MPX My Videos Collection Move, Copy and Delete operations.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef VCXMYVIDEOSASYNCFILEOPERATIONS_H |
|
21 #define VCXMYVIDEOSASYNCFILEOPERATIONS_H |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 #include <mpxcollectionplugin.h> |
|
26 #include <mpxcollectionpath.h> |
|
27 #include <mpxcollectionmessagedefs.h> |
|
28 #include <vcxmyvideosdefs.h> |
|
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 |
|
35 class CVcxMyVideosCollectionPlugin; |
|
36 |
|
37 // CONSTANTS |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * @lib mpxmyvideoscollectionplugin.lib |
|
43 */ |
|
44 NONSHARABLE_CLASS(CVcxMyVideosAsyncFileOperations) : |
|
45 public CBase |
|
46 { |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Two-phased constructor |
|
51 * @return object constructed |
|
52 */ |
|
53 static CVcxMyVideosAsyncFileOperations* NewL( CVcxMyVideosCollectionPlugin& aCollection ); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 virtual ~CVcxMyVideosAsyncFileOperations(); |
|
59 |
|
60 public: // from base classes |
|
61 |
|
62 private: |
|
63 /** |
|
64 * Constructor |
|
65 */ |
|
66 CVcxMyVideosAsyncFileOperations( CVcxMyVideosCollectionPlugin& aCollection ); |
|
67 |
|
68 /** |
|
69 * Symbian 2nd phase constructor. |
|
70 */ |
|
71 void ConstructL (); |
|
72 |
|
73 public: |
|
74 |
|
75 /** |
|
76 * Deletes the file and removes media item from the collection. |
|
77 * |
|
78 * @param aMdsId MDS id of the item to be deleted. |
|
79 * @param aForce If ETrue, the video will be deleted even if download is ongoing. |
|
80 */ |
|
81 void DeleteVideoL( TUint32 aMdsId, TBool aForce = EFalse ); |
|
82 |
|
83 /** |
|
84 * Performs one Move or Copy operation. Called by HandleStep. |
|
85 * |
|
86 * @return ETrue if operation was the last one, EFalse othewise. |
|
87 */ |
|
88 TBool HandleMoveOrCopyStepL(); |
|
89 |
|
90 /** |
|
91 * Moves or copies video to another drive. |
|
92 * |
|
93 * @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. |
|
96 */ |
|
97 void MoveOrCopyVideoL( TUint32 aMdsId, TInt aTargetDrive, TBool aMove ); |
|
98 |
|
99 /** |
|
100 * Generates and sends resp message for Move,Copy and Delete operations. |
|
101 * Does nothing if there is some other operation going on. |
|
102 * This function is called when operation is interrupted from a leave or |
|
103 * cancel request. |
|
104 * Leaves with KErrNotFound if no operation was in progress. |
|
105 * |
|
106 * @param aErr Error code which is set for non handled items in the resp array. |
|
107 */ |
|
108 void CancelOperationL( TInt aErr ); |
|
109 |
|
110 /** |
|
111 * Performs one Delete operation. Called by HandleStep. |
|
112 * |
|
113 * @return ETrue if operation was the last one, EFalse otherwise. |
|
114 */ |
|
115 TBool HandleDeleteStepL(); |
|
116 |
|
117 private: |
|
118 |
|
119 /** |
|
120 * Called when file is going to be moved or copied to aDrive. |
|
121 * Checks if target drive has enough free space. |
|
122 * |
|
123 * @param aPath File path of the file which is going to be moved or copied. |
|
124 * @param aDrive Target drive. |
|
125 * @return ETrue If target drive has enough space, EFalse otherwise. |
|
126 */ |
|
127 TBool DriveHasEnoughFreeSpaceL( const TDesC& aPath, TInt aDrive ); |
|
128 |
|
129 /** |
|
130 * Sends response array for Move, Copy or Delete operation. |
|
131 * |
|
132 * @param aMessageId Response message ID. |
|
133 */ |
|
134 void SendOperationRespL( TInt aCmdId ); |
|
135 |
|
136 /** |
|
137 * Generates target path for move and copy operations. |
|
138 * |
|
139 * @param aSourcePath Full source path. |
|
140 * @param aTargetPath Target path is written here. |
|
141 * @param aTargetDrive Target drive. |
|
142 */ |
|
143 void GenerateTargetPathForMoveOrCopyL( |
|
144 const TDesC& aSourcePath, TDes& aTargetPath, TInt aTargetDrive ); |
|
145 |
|
146 public: |
|
147 |
|
148 /** |
|
149 * Array containing item ids which are being moved/copied or deleted. |
|
150 */ |
|
151 RArray<TUint32> iOperationIdArray; |
|
152 |
|
153 /** |
|
154 * Array containing results for move/copy/delete operations. Array positions |
|
155 * are in sync with iOperationIdArray. |
|
156 */ |
|
157 RArray<TInt> iOperationResult; |
|
158 |
|
159 private: |
|
160 |
|
161 /** |
|
162 * File server session. |
|
163 */ |
|
164 RFs iFs; |
|
165 |
|
166 /** |
|
167 * The item currently being moved/copied or deleted. |
|
168 */ |
|
169 TInt iCurrentOperationIndex; |
|
170 |
|
171 /** |
|
172 * Target drive for Move or Copy operation. |
|
173 */ |
|
174 TInt iTargetDrive; |
|
175 |
|
176 /** |
|
177 * Owner of this class. |
|
178 */ |
|
179 CVcxMyVideosCollectionPlugin& iCollection; |
|
180 |
|
181 }; |
|
182 |
|
183 #endif // VCXMYVIDEOSASYNCFILEOPERATIONS_H |
|
184 |
|
185 |