|
1 /* |
|
2 * Copyright (c) 2009 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: Delete object operation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CDELETEOBJECT_H |
|
20 #define CDELETEOBJECT_H |
|
21 |
|
22 #include <f32file.h> |
|
23 #include <d32dbms.h> |
|
24 #include <badesca.h> |
|
25 |
|
26 #include "crequestprocessor.h" |
|
27 |
|
28 //forward declaration |
|
29 class RFs; |
|
30 class CMTPTypeArray; |
|
31 class MMTPObjectMgr; |
|
32 class MMmMtpDpConfig; |
|
33 |
|
34 /** |
|
35 * Defines DeleteObject request processor |
|
36 */ |
|
37 class CDeleteObject : public CRequestProcessor |
|
38 { |
|
39 public: |
|
40 /** |
|
41 * Two-phase construction method |
|
42 * @param aFramework The data provider framework |
|
43 * @param aConnection The connection from which the request comes |
|
44 * @param aWrapper medadata access interface |
|
45 * @return a pointer to the created request processor object |
|
46 */ |
|
47 IMPORT_C static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, |
|
48 MMTPConnection& aConnection, |
|
49 MMmMtpDpConfig& aDpConfig ); |
|
50 |
|
51 /** |
|
52 * Destructor |
|
53 */ |
|
54 IMPORT_C virtual ~CDeleteObject(); |
|
55 |
|
56 private: |
|
57 /** |
|
58 * Standard c++ constructor |
|
59 * @param aFramework The data provider framework |
|
60 * @param aConnection The connection from which the request comes |
|
61 * @param aWrapper medadata access interface |
|
62 */ |
|
63 IMPORT_C CDeleteObject( MMTPDataProviderFramework& aFramework, |
|
64 MMTPConnection& aConnection, |
|
65 MMmMtpDpConfig& aDpConfig ); |
|
66 |
|
67 protected: |
|
68 //from CRequestProcessor |
|
69 /** |
|
70 * DeleteObject request handler |
|
71 */ |
|
72 IMPORT_C void ServiceL(); |
|
73 |
|
74 //from CActive |
|
75 /** |
|
76 * AO Run method, deletes a selection of files on the system |
|
77 */ |
|
78 IMPORT_C void RunL(); |
|
79 |
|
80 /** |
|
81 * Used to cancel the deletion of the files |
|
82 */ |
|
83 IMPORT_C void DoCancel(); |
|
84 |
|
85 private: |
|
86 void ConstructL(); |
|
87 /** |
|
88 * Control the deletion |
|
89 */ |
|
90 void StartL(); |
|
91 /** |
|
92 * Delete all child objects of an association recursively. |
|
93 */ |
|
94 void DeleteAllChildrenL(); |
|
95 |
|
96 /** |
|
97 * Delete all of the associations if file deletion was successful |
|
98 * Then signals that the deletion has been completed |
|
99 */ |
|
100 void ProcessFinalPhaseL(); |
|
101 |
|
102 /** |
|
103 * Gets all object handles (for GetObjectHandlesL) |
|
104 */ |
|
105 void GetObjectHandlesL( TUint32 aStorageId, TUint32 aParentHandle ); |
|
106 |
|
107 /** |
|
108 * Deletes an object from the file system and the object store |
|
109 */ |
|
110 void DeleteObjectL( const CMTPObjectMetaData& aObjectInfo ); |
|
111 |
|
112 private: |
|
113 // MTP Object Manager |
|
114 MMTPObjectMgr& iObjectMgr; |
|
115 |
|
116 // File server used to open the database |
|
117 RFs& iFs; |
|
118 |
|
119 // Array of all the objects to delete |
|
120 RArray<TUint> iObjectsToDelete; |
|
121 |
|
122 // Keeps track of any errors that occur |
|
123 TInt iDeleteError; |
|
124 |
|
125 // Keeps track of whether any files where deleted |
|
126 TBool iIsMultiDelete; |
|
127 |
|
128 // Accessor of DB |
|
129 MMmMtpDpConfig& iDpConfig; |
|
130 }; |
|
131 |
|
132 #endif // CDELETEOBJECT_H |