1 /* |
|
2 * Copyright (c) 2002-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: Deletes items |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CFILEMANAGERACTIVEDELETE_H |
|
20 #define CFILEMANAGERACTIVEDELETE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <badesca.h> |
|
25 #include <AknWaitNoteWrapper.h> |
|
26 // FORWARD DECLARATIONS |
|
27 class CFileManagerEngine; |
|
28 class CDirScan; |
|
29 //class CMGXFileManager; |
|
30 class CFileManagerUtils; |
|
31 |
|
32 |
|
33 // CLASS DECLARATION |
|
34 /** |
|
35 * Deletes items |
|
36 * Delete operation is done one item at time, so that it can be cancelled |
|
37 * during operation. |
|
38 * |
|
39 * @lib FileManagerEngine.lib |
|
40 * @since 2.0 |
|
41 */ |
|
42 NONSHARABLE_CLASS(CFileManagerActiveDelete) : public CBase, |
|
43 public MAknBackgroundProcess |
|
44 { |
|
45 public: |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 */ |
|
49 static CFileManagerActiveDelete* NewL( |
|
50 CArrayFixFlat< TInt >& aIndexList, |
|
51 CFileManagerEngine& aEngine, |
|
52 CFileManagerUtils& aUtils ); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 IMPORT_C ~CFileManagerActiveDelete(); |
|
58 |
|
59 public: // From MAknBackgroundProcess |
|
60 |
|
61 void StepL(); |
|
62 |
|
63 TBool IsProcessDone() const; |
|
64 |
|
65 void DialogDismissedL( TInt aButtonId ); |
|
66 |
|
67 public: |
|
68 |
|
69 /** |
|
70 * Returns last known error code |
|
71 * @since 2.0 |
|
72 * @param aFileName a refence to reserved buffer |
|
73 where file name related to error can be copied |
|
74 * @return common error code |
|
75 */ |
|
76 IMPORT_C TInt GetError(TDes& aFileName); |
|
77 |
|
78 /** |
|
79 * Returns count of deleted DRM items |
|
80 * @since 2.0 |
|
81 * @param aTotalCount (out) returns total count of deleted items |
|
82 * @return count of deleted DRM items |
|
83 */ |
|
84 IMPORT_C TInt DeletedDrmItems( TInt& aTotalCount ); |
|
85 |
|
86 |
|
87 private: |
|
88 /** |
|
89 * Constructor |
|
90 */ |
|
91 CFileManagerActiveDelete( |
|
92 RFs& aFs, |
|
93 CArrayFixFlat< TInt >& aIndexList, |
|
94 CFileManagerEngine& aEngine, |
|
95 CFileManagerUtils& aUtils ); |
|
96 |
|
97 /** |
|
98 * By default Symbian 2nd phase constructor is private. |
|
99 */ |
|
100 void ConstructL(); |
|
101 |
|
102 private: |
|
103 |
|
104 /** |
|
105 * This function handles the directory item deletion. |
|
106 * Deletes one item per call |
|
107 */ |
|
108 TBool DeleteItemsInDirectoryL(); |
|
109 |
|
110 /** |
|
111 * This function handles the file deletion. |
|
112 */ |
|
113 void DeleteFileL( |
|
114 const TDesC& aFullPath, const TBool aReadOnlyChecked = EFalse ); |
|
115 |
|
116 /** |
|
117 * This function checks is item file or directory. |
|
118 */ |
|
119 TBool IsDir( const TDesC& aFullPath ); |
|
120 |
|
121 /** |
|
122 * This function sets the name returned to user. |
|
123 */ |
|
124 void SetName( const TDesC& aFullPath, TBool aOverWrite = EFalse ); |
|
125 |
|
126 /** |
|
127 * This function checks is error ignored by delete. |
|
128 */ |
|
129 TBool IsError( TInt aErr ); |
|
130 |
|
131 /** |
|
132 * This function sets the error returned to user. |
|
133 */ |
|
134 void SetError( TInt aErr, const TDesC& aFullPath ); |
|
135 |
|
136 /** |
|
137 * This function flushes the notification array. |
|
138 */ |
|
139 void FlushNotifications(); |
|
140 |
|
141 private: // Data |
|
142 /// Ref: reference to engine created file server session |
|
143 RFs& iFs; |
|
144 |
|
145 /// Ref: array of items to be deleted from current view |
|
146 CArrayFixFlat< TInt >& iIndexList; |
|
147 |
|
148 /// Current index in given array |
|
149 TInt iCurrentIndex; |
|
150 |
|
151 /// When all folders are through, this is set |
|
152 TBool iProcessDone; |
|
153 |
|
154 /// Latest error |
|
155 TInt iError; |
|
156 |
|
157 /// Own: latest deleted file name or file name which delete has failed |
|
158 TFileName iFileName; |
|
159 |
|
160 /// current file index in CDirScan |
|
161 TInt iFileIndex; |
|
162 |
|
163 /// Own: Used to scan directories |
|
164 CDirScan* iDirScan; |
|
165 |
|
166 /// Own: Scan result is stored here |
|
167 CDir* iDir; |
|
168 |
|
169 /// Count of not deleted items |
|
170 TInt iNotDeletedItems; |
|
171 |
|
172 /// Count of open items |
|
173 TInt iOpenFiles; |
|
174 |
|
175 /// Own: buffer for storing the current item name to be deleted |
|
176 HBufC* iStringBuffer; |
|
177 |
|
178 /// Ref: reference to engine instance |
|
179 CFileManagerEngine& iEngine; |
|
180 |
|
181 /// Own: full path of the item to be deleted |
|
182 HBufC* iFullPath; |
|
183 |
|
184 /// Count of deleted drm files |
|
185 TInt iDeletedDrmItems; |
|
186 |
|
187 /// Count of deleted items |
|
188 TInt iDeletedItems; |
|
189 |
|
190 // Ref: MG2 update notification object |
|
191 //CMGXFileManager* iMgxFileManager; |
|
192 |
|
193 // Ref: reference to utils instance |
|
194 CFileManagerUtils& iUtils; |
|
195 |
|
196 // Own: Set if current drive is remote drive |
|
197 TBool iIsRemoteDrive; |
|
198 |
|
199 // Own: Buffer for storing delete items for MG2 notifications |
|
200 CDesCArray* iRemovedItems; |
|
201 |
|
202 }; |
|
203 |
|
204 #endif // CFileManagerActiveFind_H |
|
205 |
|
206 // End of File |
|
207 |
|