|
1 /* |
|
2 * Copyright (c) 2006-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: Monitors file creations, modifications and deletions.* |
|
15 */ |
|
16 |
|
17 |
|
18 #ifndef __FILEEVENTHANDLERAO_H__ |
|
19 #define __FILEEVENTHANDLERAO_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <f32file.h> |
|
23 |
|
24 #include "movetimer.h" |
|
25 #include "mdsfileserverpluginclient.h" |
|
26 #include <harvesterdata.h> |
|
27 |
|
28 // FORWARD DECLARATION |
|
29 class CMdEHarvesterSession; |
|
30 class CProcessOriginMapper; |
|
31 class CMdEObject; |
|
32 class CMdEPropertyDef; |
|
33 class CFolderRenamer; |
|
34 class CHarvesterPluginFactory; |
|
35 class CMdsFSPQueueItem; |
|
36 |
|
37 class CFileEventHandlerAO : public CActive, public MMoveTimerObserver |
|
38 { |
|
39 public: |
|
40 enum TRequest |
|
41 { |
|
42 ERequestIdle, |
|
43 ERequestProcessing |
|
44 }; |
|
45 |
|
46 /** |
|
47 * Creates and constructs a new instance of CFileEventHandlerAO. |
|
48 * |
|
49 * @return A pointer to the new instance of CFileEventHandlerAO |
|
50 */ |
|
51 static CFileEventHandlerAO* NewL( MMonitorPluginObserver& aObserver, |
|
52 CMdEHarvesterSession* aMdeSession, |
|
53 CHarvesterPluginFactory* aHarvesterPluginFactory ); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 virtual ~CFileEventHandlerAO(); |
|
59 |
|
60 /** |
|
61 * Inherited from CActive. This method will be called on file server notifying. |
|
62 */ |
|
63 void RunL(); |
|
64 |
|
65 /** |
|
66 * Handles a leave occurring in the request completion event handler RunL(). |
|
67 * |
|
68 * @param aError An error code. |
|
69 * @return An error code. |
|
70 */ |
|
71 TInt RunError( TInt aError ); |
|
72 |
|
73 /** |
|
74 * Cancels file server notifying. Inherited from CActive. |
|
75 */ |
|
76 void DoCancel(); |
|
77 |
|
78 /** |
|
79 * Sets a list of paths not monitor to. |
|
80 * |
|
81 * @param aList Contains list of paths not monitor to. |
|
82 */ |
|
83 void SetIgnoreListL( RPointerArray<TDesC>& aList ); |
|
84 |
|
85 /** |
|
86 * Gets a reference to process / origin mapper, which |
|
87 * can be used to register and match which process ids |
|
88 * with a mde object's Origin value. |
|
89 * @return Handle to File monitor's CProcessOriginMapper. |
|
90 */ |
|
91 CProcessOriginMapper& Mapper(); |
|
92 |
|
93 /** |
|
94 * Notifies file monitor about new events |
|
95 */ |
|
96 void HandleNotificationL(TMdsFSPStatus &aEvent); |
|
97 |
|
98 /** |
|
99 * Notifies file monitor about multiple delete events |
|
100 */ |
|
101 void HandleMultideletionL( CArrayFixSeg< TMdsFSPStatus >* aEvents ); |
|
102 |
|
103 /** |
|
104 * @Returns filemonitors mde session |
|
105 * @return mde session object |
|
106 */ |
|
107 CMdEHarvesterSession * MdeHarvesterSession(); |
|
108 |
|
109 |
|
110 void AddToQueueL(TMdsFSPStatus &aEvent); |
|
111 |
|
112 void SetCachingStatus( TBool aCachingStatus ); |
|
113 |
|
114 private: |
|
115 /** |
|
116 * C++ constructor - not exported; |
|
117 * implicitly called from NewL() |
|
118 */ |
|
119 CFileEventHandlerAO(); |
|
120 |
|
121 /** |
|
122 * 2nd phase construction, called by NewL() |
|
123 */ |
|
124 void ConstructL( MMonitorPluginObserver& aObserver, |
|
125 CMdEHarvesterSession* aMdeSession, |
|
126 CHarvesterPluginFactory* aHarvesterPluginFactory ); |
|
127 |
|
128 |
|
129 /** |
|
130 * |
|
131 */ |
|
132 void ResetEvent(); |
|
133 |
|
134 void NotMoveEvent(RPointerArray<CHarvesterData>& aHDArray); |
|
135 |
|
136 /** |
|
137 * |
|
138 */ |
|
139 void RenameToMDEL( const TDesC& aOldUrl, const TDesC& aNewUrl, TOrigin aOrigin ); |
|
140 |
|
141 /** |
|
142 * |
|
143 */ |
|
144 void ReplaceL( const TDesC& aOldUrl, const TDesC& aNewUrl, TOrigin aOrigin, TBool aFastHarvest ); |
|
145 |
|
146 /** |
|
147 * |
|
148 */ |
|
149 void ModifyL( const TDesC& aUrl, TOrigin aOrigin, TBool aFastHarvest ); |
|
150 |
|
151 /** |
|
152 * |
|
153 */ |
|
154 void DeleteFromMDEL( const TDesC& aUrl ); |
|
155 |
|
156 /** |
|
157 * |
|
158 */ |
|
159 void MultiDeleteFromMDEL( const RPointerArray<TDesC>& aUrls ); |
|
160 |
|
161 /** |
|
162 * |
|
163 */ |
|
164 void FormatL( TUint32 aOldMediaId, TBool aSubClose ); |
|
165 |
|
166 /** |
|
167 * |
|
168 */ |
|
169 TOrigin OriginFromMdEObjectL( CMdEObject& aObject ); |
|
170 |
|
171 /** |
|
172 * |
|
173 */ |
|
174 void OriginToMdEObjectL( CMdEObject& aObject, TOrigin aOrigin ); |
|
175 |
|
176 |
|
177 void SetNextRequest( TRequest aRequest ); |
|
178 |
|
179 void ReadCacheSizeFromCenrepL(); |
|
180 |
|
181 /** |
|
182 * Set MdE object's title with aNewUrl |
|
183 */ |
|
184 void SetTitleL( CMdEObject* aOldObject, const TDesC& aNewUrl ); |
|
185 |
|
186 void SetModifiedTimeL( CMdEObject* aOldObject, const TDesC& aNewUrl ); |
|
187 |
|
188 private: |
|
189 |
|
190 /** |
|
191 * @var An observer class to notify about file creations, modifications and deletions. |
|
192 */ |
|
193 MMonitorPluginObserver* iObserver; |
|
194 |
|
195 /** |
|
196 * @var A file server. |
|
197 */ |
|
198 RFs iFs; |
|
199 |
|
200 /** |
|
201 * @var An ignore list. Contains paths not to monitor. |
|
202 */ |
|
203 RPointerArray<TDesC> iIgnoreList; |
|
204 |
|
205 |
|
206 /** |
|
207 * |
|
208 */ |
|
209 TMdsFSPStatusPckg iStatusPckg; |
|
210 |
|
211 /** |
|
212 * @var Mde client session pointer. |
|
213 */ |
|
214 CMdEHarvesterSession* iMdeSession; |
|
215 |
|
216 /** |
|
217 * Process id / origin mapper. |
|
218 */ |
|
219 CProcessOriginMapper* iMapper; |
|
220 |
|
221 /** |
|
222 * MoveTimer to check if move is coming... |
|
223 */ |
|
224 CMoveTimer* iMoveTimer; |
|
225 |
|
226 /** |
|
227 * Active object which is used to handle folder rename events |
|
228 * |
|
229 */ |
|
230 CFolderRenamer *iFolderRenamer; |
|
231 |
|
232 /** |
|
233 * @var Harvester plugin factory pointer. |
|
234 */ |
|
235 CHarvesterPluginFactory* iHarvesterPluginFactory; |
|
236 |
|
237 RPointerArray<CMdsFSPQueueItem> iQueue; |
|
238 |
|
239 TRequest iNextRequest; |
|
240 |
|
241 TBool iCacheEvents; |
|
242 |
|
243 TMdsFSPStatus iEvent; |
|
244 |
|
245 CArrayFixSeg< TMdsFSPStatus >* iEventArray; |
|
246 RPointerArray<TDesC> iUriArray; |
|
247 |
|
248 TInt iCacheSize; |
|
249 |
|
250 CMdEPropertyDef* iOriginPropertyDef; |
|
251 CMdEPropertyDef* iTitlePropertyDef; |
|
252 CMdEPropertyDef* iTimePropertyDef; |
|
253 }; |
|
254 |
|
255 #endif // __FILEEVENTHANDLERAO_H__ |