sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@test
|
sl@0
|
21 |
@internalComponent
|
sl@0
|
22 |
|
sl@0
|
23 |
This contains CT_FileManData
|
sl@0
|
24 |
*/
|
sl@0
|
25 |
|
sl@0
|
26 |
// User includes
|
sl@0
|
27 |
#include "T_FileManData.h"
|
sl@0
|
28 |
#include "T_SfSrvServer.h"
|
sl@0
|
29 |
|
sl@0
|
30 |
const TInt KMaxFileNameLength =255;
|
sl@0
|
31 |
|
sl@0
|
32 |
/*@{*/
|
sl@0
|
33 |
/// Parameters
|
sl@0
|
34 |
_LIT(KPath, "path");
|
sl@0
|
35 |
_LIT(KFileName, "filename");
|
sl@0
|
36 |
_LIT(KFileFrom, "filefrom");
|
sl@0
|
37 |
_LIT(KFileTo, "fileto");
|
sl@0
|
38 |
_LIT(KOldName, "oldname");
|
sl@0
|
39 |
_LIT(KNewName, "newname");
|
sl@0
|
40 |
_LIT(KRFsObject, "rfsObject");
|
sl@0
|
41 |
_LIT(KRFileObject, "rfileObject");
|
sl@0
|
42 |
_LIT(KUseObserver, "use_observer");
|
sl@0
|
43 |
_LIT(KAsync, "async");
|
sl@0
|
44 |
_LIT(KTime, "time");
|
sl@0
|
45 |
_LIT(KSetMask, "setmask");
|
sl@0
|
46 |
_LIT(KClearMask, "clearmask");
|
sl@0
|
47 |
_LIT(KOperation, "operation");
|
sl@0
|
48 |
_LIT(KCurrentAction, "current_action");
|
sl@0
|
49 |
_LIT(KBytes, "bytes");
|
sl@0
|
50 |
_LIT(KError, "error");
|
sl@0
|
51 |
_LIT(KTarget, "target");
|
sl@0
|
52 |
_LIT(KSource, "source");
|
sl@0
|
53 |
_LIT(KNotifyType, "notify_type");
|
sl@0
|
54 |
_LIT(KReadHistory, "read_history");
|
sl@0
|
55 |
_LIT(KName, "name");
|
sl@0
|
56 |
_LIT(KNullDesCStr, "KNullDesC");
|
sl@0
|
57 |
_LIT(KTotalBytes, "total_bytes");
|
sl@0
|
58 |
_LIT(KFlag, "flag");
|
sl@0
|
59 |
_LIT(KClearHistory, "clear_history");
|
sl@0
|
60 |
_LIT(KSetTcontrol, "set_tcontrol");
|
sl@0
|
61 |
//For searching file names.
|
sl@0
|
62 |
_LIT(KPattern, "*%S*");
|
sl@0
|
63 |
|
sl@0
|
64 |
/// Commands
|
sl@0
|
65 |
_LIT(KCmdNewL, "NewL");
|
sl@0
|
66 |
_LIT(KCmdAttribs, "Attribs");
|
sl@0
|
67 |
_LIT(KCmdCopy, "Copy");
|
sl@0
|
68 |
_LIT(KCmdMove, "Move");
|
sl@0
|
69 |
_LIT(KCmdDelete, "Delete");
|
sl@0
|
70 |
_LIT(KCmdRename, "Rename");
|
sl@0
|
71 |
_LIT(KCmdRmDir, "RmDir");
|
sl@0
|
72 |
_LIT(KCmdSetObserver, "SetObserver");
|
sl@0
|
73 |
_LIT(KCmdCurrentAction, "CurrentAction");
|
sl@0
|
74 |
_LIT(KCmdGetCurrentTarget, "GetCurrentTarget");
|
sl@0
|
75 |
_LIT(KCmdGetCurrentSource, "GetCurrentSource");
|
sl@0
|
76 |
_LIT(KCmdBytesTransferredByCopyStep, "BytesTransferredByCopyStep");
|
sl@0
|
77 |
_LIT(KCmdCurrentEntry, "CurrentEntry");
|
sl@0
|
78 |
_LIT(KCmdAbbreviatedPath, "AbbreviatedPath");
|
sl@0
|
79 |
_LIT(KCmdFullPath, "FullPath");
|
sl@0
|
80 |
_LIT(KCmdGetLastError, "GetLastError");
|
sl@0
|
81 |
_LIT(KCmdGetMoreInfoAboutError, "GetMoreInfoAboutError");
|
sl@0
|
82 |
_LIT(KCmdDestructor, "~");
|
sl@0
|
83 |
|
sl@0
|
84 |
// TActions
|
sl@0
|
85 |
_LIT(KENone, "ENone");
|
sl@0
|
86 |
_LIT(KEAttribs, "EAttribs");
|
sl@0
|
87 |
_LIT(KECopy, "ECopy");
|
sl@0
|
88 |
_LIT(KEDelete, "EDelete");
|
sl@0
|
89 |
_LIT(KEMove, "EMove");
|
sl@0
|
90 |
_LIT(KERename, "ERename");
|
sl@0
|
91 |
_LIT(KERmDir, "ERmDir");
|
sl@0
|
92 |
_LIT(KERenameInvalidEntry, "ERenameInvalidEntry");
|
sl@0
|
93 |
_LIT(KECopyFromHandle, "ECopyFromHandle");
|
sl@0
|
94 |
|
sl@0
|
95 |
|
sl@0
|
96 |
// TSwitch
|
sl@0
|
97 |
_LIT(KEOverWrite, "EOverWrite");
|
sl@0
|
98 |
_LIT(KERecurse, "ERecurse");
|
sl@0
|
99 |
|
sl@0
|
100 |
// TControl
|
sl@0
|
101 |
_LIT(KEContinue, "EContinue");
|
sl@0
|
102 |
_LIT(KEAbort, "EAbort");
|
sl@0
|
103 |
_LIT(KECancel, "ECancel");
|
sl@0
|
104 |
_LIT(KERetry, "ERetry");
|
sl@0
|
105 |
|
sl@0
|
106 |
// TFileManError
|
sl@0
|
107 |
_LIT(KENoExtraInformation, "ENoExtraInformation");
|
sl@0
|
108 |
_LIT(KEInitializationFailed, "EInitializationFailed");
|
sl@0
|
109 |
_LIT(KEScanNextDirectoryFailed, "EScanNextDirectoryFailed");
|
sl@0
|
110 |
_LIT(KESrcOpenFailed, "ESrcOpenFailed");
|
sl@0
|
111 |
_LIT(KETrgOpenFailed, "ETrgOpenFailed");
|
sl@0
|
112 |
_LIT(KENoFilesProcessed, "ENoFilesProcessed");
|
sl@0
|
113 |
|
sl@0
|
114 |
//Notifys
|
sl@0
|
115 |
_LIT(KNotifyStarted, "started");
|
sl@0
|
116 |
_LIT(KNotifyOperation, "operation");
|
sl@0
|
117 |
_LIT(KNotifyEnded, "ended");
|
sl@0
|
118 |
|
sl@0
|
119 |
|
sl@0
|
120 |
|
sl@0
|
121 |
CT_FileManData* CT_FileManData::NewL()
|
sl@0
|
122 |
/**
|
sl@0
|
123 |
* Two phase constructor
|
sl@0
|
124 |
*/
|
sl@0
|
125 |
{
|
sl@0
|
126 |
CT_FileManData* ret = new (ELeave) CT_FileManData();
|
sl@0
|
127 |
CleanupStack::PushL(ret);
|
sl@0
|
128 |
ret->ConstructL();
|
sl@0
|
129 |
CleanupStack::Pop(ret);
|
sl@0
|
130 |
return ret;
|
sl@0
|
131 |
}
|
sl@0
|
132 |
|
sl@0
|
133 |
|
sl@0
|
134 |
CT_FileManData::CT_FileManData()
|
sl@0
|
135 |
: iFileMan(NULL)
|
sl@0
|
136 |
, iAsyncErrorIndex(0)
|
sl@0
|
137 |
, iAsyncCall(EFalse)
|
sl@0
|
138 |
, iFileManObserver(NULL)
|
sl@0
|
139 |
, iUseTControl(EFalse)
|
sl@0
|
140 |
|
sl@0
|
141 |
/**
|
sl@0
|
142 |
* Protected constructor. First phase construction
|
sl@0
|
143 |
*/
|
sl@0
|
144 |
{
|
sl@0
|
145 |
}
|
sl@0
|
146 |
|
sl@0
|
147 |
|
sl@0
|
148 |
void CT_FileManData::ConstructL()
|
sl@0
|
149 |
/**
|
sl@0
|
150 |
* Protected constructor. Second phase construction
|
sl@0
|
151 |
*/
|
sl@0
|
152 |
{
|
sl@0
|
153 |
}
|
sl@0
|
154 |
|
sl@0
|
155 |
|
sl@0
|
156 |
CT_FileManData::~CT_FileManData()
|
sl@0
|
157 |
/**
|
sl@0
|
158 |
* Destructor.
|
sl@0
|
159 |
*/
|
sl@0
|
160 |
{
|
sl@0
|
161 |
DoCleanup();
|
sl@0
|
162 |
|
sl@0
|
163 |
iAttribs.ResetAndDestroy();
|
sl@0
|
164 |
iCopy.ResetAndDestroy();
|
sl@0
|
165 |
iDelete.ResetAndDestroy();
|
sl@0
|
166 |
iMove.ResetAndDestroy();
|
sl@0
|
167 |
iRename.ResetAndDestroy();
|
sl@0
|
168 |
iRmDir.ResetAndDestroy();
|
sl@0
|
169 |
|
sl@0
|
170 |
ClearHistory();
|
sl@0
|
171 |
}
|
sl@0
|
172 |
|
sl@0
|
173 |
TAny* CT_FileManData::GetObject()
|
sl@0
|
174 |
{
|
sl@0
|
175 |
return iFileMan;
|
sl@0
|
176 |
}
|
sl@0
|
177 |
|
sl@0
|
178 |
|
sl@0
|
179 |
TBool CT_FileManData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
|
sl@0
|
180 |
/**
|
sl@0
|
181 |
* Process a command read from the ini file
|
sl@0
|
182 |
*
|
sl@0
|
183 |
* @param aCommand the command to process
|
sl@0
|
184 |
* @param aSection the section in the ini file requiring the command to be processed
|
sl@0
|
185 |
*
|
sl@0
|
186 |
* @return ETrue if the command is processed
|
sl@0
|
187 |
*/
|
sl@0
|
188 |
{
|
sl@0
|
189 |
TBool retVal = ETrue;
|
sl@0
|
190 |
|
sl@0
|
191 |
if (aCommand == KCmdNewL)
|
sl@0
|
192 |
{
|
sl@0
|
193 |
DoCmdNewL(aSection);
|
sl@0
|
194 |
}
|
sl@0
|
195 |
else if (aCommand == KCmdDestructor)
|
sl@0
|
196 |
{
|
sl@0
|
197 |
DoCleanup();
|
sl@0
|
198 |
}
|
sl@0
|
199 |
else if (aCommand == KCmdAttribs)
|
sl@0
|
200 |
{
|
sl@0
|
201 |
DoCmdAttribsL(aSection, aAsyncErrorIndex);
|
sl@0
|
202 |
}
|
sl@0
|
203 |
else if (aCommand == KCmdCopy)
|
sl@0
|
204 |
{
|
sl@0
|
205 |
DoCmdCopyL(aSection, aAsyncErrorIndex);
|
sl@0
|
206 |
}
|
sl@0
|
207 |
else if (aCommand == KCmdMove)
|
sl@0
|
208 |
{
|
sl@0
|
209 |
DoCmdMoveL(aSection, aAsyncErrorIndex);
|
sl@0
|
210 |
}
|
sl@0
|
211 |
else if (aCommand == KCmdDelete)
|
sl@0
|
212 |
{
|
sl@0
|
213 |
DoCmdDeleteL(aSection, aAsyncErrorIndex);
|
sl@0
|
214 |
}
|
sl@0
|
215 |
else if (aCommand == KCmdRename)
|
sl@0
|
216 |
{
|
sl@0
|
217 |
DoCmdRenameL(aSection, aAsyncErrorIndex);
|
sl@0
|
218 |
}
|
sl@0
|
219 |
else if (aCommand == KCmdRmDir)
|
sl@0
|
220 |
{
|
sl@0
|
221 |
DoCmdRmDirL(aSection, aAsyncErrorIndex);
|
sl@0
|
222 |
}
|
sl@0
|
223 |
else if (aCommand == KCmdSetObserver)
|
sl@0
|
224 |
{
|
sl@0
|
225 |
DoCmdSetObserver();
|
sl@0
|
226 |
}
|
sl@0
|
227 |
else if (aCommand == KCmdCurrentAction)
|
sl@0
|
228 |
{
|
sl@0
|
229 |
DoCmdCurrentAction(aSection);
|
sl@0
|
230 |
}
|
sl@0
|
231 |
else if (aCommand == KCmdGetCurrentTarget)
|
sl@0
|
232 |
{
|
sl@0
|
233 |
DoCmdGetCurrentTarget(aSection);
|
sl@0
|
234 |
}
|
sl@0
|
235 |
else if (aCommand == KCmdGetCurrentSource)
|
sl@0
|
236 |
{
|
sl@0
|
237 |
DoCmdGetCurrentSource(aSection);
|
sl@0
|
238 |
}
|
sl@0
|
239 |
else if (aCommand == KCmdBytesTransferredByCopyStep)
|
sl@0
|
240 |
{
|
sl@0
|
241 |
DoCmdBytesTransferredByCopyStep(aSection);
|
sl@0
|
242 |
}
|
sl@0
|
243 |
else if(aCommand == KCmdCurrentEntry)
|
sl@0
|
244 |
{
|
sl@0
|
245 |
DoCmdCurrentEntryL(aSection);
|
sl@0
|
246 |
}
|
sl@0
|
247 |
else if(aCommand == KCmdAbbreviatedPath)
|
sl@0
|
248 |
{
|
sl@0
|
249 |
DoCmdAbbreviatedPath(aSection);
|
sl@0
|
250 |
}
|
sl@0
|
251 |
else if(aCommand == KCmdFullPath)
|
sl@0
|
252 |
{
|
sl@0
|
253 |
DoCmdFullPath(aSection);
|
sl@0
|
254 |
}
|
sl@0
|
255 |
else if(aCommand == KCmdGetLastError)
|
sl@0
|
256 |
{
|
sl@0
|
257 |
DoCmdGetLastError(aSection);
|
sl@0
|
258 |
}
|
sl@0
|
259 |
else if(aCommand == KCmdGetMoreInfoAboutError)
|
sl@0
|
260 |
{
|
sl@0
|
261 |
DoCmdGetMoreInfoAboutError(aSection);
|
sl@0
|
262 |
}
|
sl@0
|
263 |
return retVal;
|
sl@0
|
264 |
}
|
sl@0
|
265 |
|
sl@0
|
266 |
void CT_FileManData::DoCleanup()
|
sl@0
|
267 |
{
|
sl@0
|
268 |
INFO_PRINTF1(_L("Doing cleanup"));
|
sl@0
|
269 |
|
sl@0
|
270 |
if (iFileMan)
|
sl@0
|
271 |
{
|
sl@0
|
272 |
delete(iFileMan);
|
sl@0
|
273 |
iFileMan = NULL;
|
sl@0
|
274 |
}
|
sl@0
|
275 |
ClearHistory();
|
sl@0
|
276 |
}
|
sl@0
|
277 |
|
sl@0
|
278 |
/** Inform the observer that an operation is about to start **/
|
sl@0
|
279 |
MFileManObserver::TControl CT_FileManData::NotifyFileManStarted()
|
sl@0
|
280 |
{
|
sl@0
|
281 |
THistoryData *record = new THistoryData();
|
sl@0
|
282 |
CreateHistoryRecord(*record);
|
sl@0
|
283 |
iStartedHistory.Append(record);
|
sl@0
|
284 |
if(record->iLastError != KErrNone)
|
sl@0
|
285 |
{
|
sl@0
|
286 |
if(iAsyncCall)
|
sl@0
|
287 |
{
|
sl@0
|
288 |
SetAsyncError(iAsyncErrorIndex, record->iLastError);
|
sl@0
|
289 |
iAsyncCall = EFalse;
|
sl@0
|
290 |
}
|
sl@0
|
291 |
else
|
sl@0
|
292 |
{
|
sl@0
|
293 |
SetError(record->iLastError);
|
sl@0
|
294 |
}
|
sl@0
|
295 |
}
|
sl@0
|
296 |
TControl ret = EContinue;
|
sl@0
|
297 |
//Check if we need to return TControl value specified in INI.
|
sl@0
|
298 |
if(iUseTControl && iObserverNotifyType == ENotifyStarted)
|
sl@0
|
299 |
{
|
sl@0
|
300 |
TBuf<KMaxFileNameLength> buffer;
|
sl@0
|
301 |
buffer.Format(KPattern(), &iNotifyFileName);
|
sl@0
|
302 |
//Check if we need to return TControl for this file.
|
sl@0
|
303 |
if(record->iCurrentSource.Match(buffer) != KErrNotFound)
|
sl@0
|
304 |
{
|
sl@0
|
305 |
iUseTControl = EFalse;
|
sl@0
|
306 |
ret = iTControl;
|
sl@0
|
307 |
}
|
sl@0
|
308 |
}
|
sl@0
|
309 |
return ret;
|
sl@0
|
310 |
}
|
sl@0
|
311 |
|
sl@0
|
312 |
/** Informs the observer that an operation, i.e. a copy or a move, is proceeding. **/
|
sl@0
|
313 |
MFileManObserver::TControl CT_FileManData::NotifyFileManOperation()
|
sl@0
|
314 |
{
|
sl@0
|
315 |
THistoryData *record = new THistoryData();
|
sl@0
|
316 |
CreateHistoryRecord(*record);
|
sl@0
|
317 |
iOperationHistory.Append(record);
|
sl@0
|
318 |
if(record->iLastError != KErrNone)
|
sl@0
|
319 |
{
|
sl@0
|
320 |
if(iAsyncCall)
|
sl@0
|
321 |
{
|
sl@0
|
322 |
SetAsyncError(iAsyncErrorIndex, record->iLastError);
|
sl@0
|
323 |
iAsyncCall = EFalse;
|
sl@0
|
324 |
}
|
sl@0
|
325 |
else
|
sl@0
|
326 |
{
|
sl@0
|
327 |
SetError(record->iLastError);
|
sl@0
|
328 |
}
|
sl@0
|
329 |
}
|
sl@0
|
330 |
TControl ret = EContinue;
|
sl@0
|
331 |
//Check if we need to return TControl value specified in INI.
|
sl@0
|
332 |
if(iUseTControl && iObserverNotifyType == ENotifyOperation)
|
sl@0
|
333 |
{
|
sl@0
|
334 |
TBuf<KMaxFileNameLength> buffer;
|
sl@0
|
335 |
buffer.Format(KPattern(), &iNotifyFileName);
|
sl@0
|
336 |
//Check if we need to return TControl for this file.
|
sl@0
|
337 |
if(record->iCurrentSource.Match(buffer) != KErrNotFound)
|
sl@0
|
338 |
{
|
sl@0
|
339 |
iUseTControl = EFalse;
|
sl@0
|
340 |
ret = iTControl;
|
sl@0
|
341 |
}
|
sl@0
|
342 |
}
|
sl@0
|
343 |
return ret;
|
sl@0
|
344 |
}
|
sl@0
|
345 |
|
sl@0
|
346 |
/** Informs the observer that an operation is complete. **/
|
sl@0
|
347 |
MFileManObserver::TControl CT_FileManData::NotifyFileManEnded()
|
sl@0
|
348 |
{
|
sl@0
|
349 |
THistoryData *record = new THistoryData();
|
sl@0
|
350 |
CreateHistoryRecord(*record);
|
sl@0
|
351 |
iEndedHistory.Append(record);
|
sl@0
|
352 |
if(record->iLastError != KErrNone)
|
sl@0
|
353 |
{
|
sl@0
|
354 |
if(iAsyncCall)
|
sl@0
|
355 |
{
|
sl@0
|
356 |
SetAsyncError(iAsyncErrorIndex, record->iLastError);
|
sl@0
|
357 |
iAsyncCall = EFalse;
|
sl@0
|
358 |
}
|
sl@0
|
359 |
else
|
sl@0
|
360 |
{
|
sl@0
|
361 |
SetError(record->iLastError);
|
sl@0
|
362 |
}
|
sl@0
|
363 |
}
|
sl@0
|
364 |
TControl ret = EContinue;
|
sl@0
|
365 |
//Check if we need to return TControl value specified in INI.
|
sl@0
|
366 |
if(iUseTControl && iObserverNotifyType == ENotifyEnded)
|
sl@0
|
367 |
{
|
sl@0
|
368 |
TBuf<KMaxFileNameLength> buffer;
|
sl@0
|
369 |
buffer.Format(KPattern(), &iNotifyFileName);
|
sl@0
|
370 |
//Check if we need to return TControl for this file.
|
sl@0
|
371 |
if(record->iCurrentSource.Match(buffer) != KErrNotFound)
|
sl@0
|
372 |
{
|
sl@0
|
373 |
iUseTControl = EFalse;
|
sl@0
|
374 |
ret = iTControl;
|
sl@0
|
375 |
}
|
sl@0
|
376 |
}
|
sl@0
|
377 |
return ret;
|
sl@0
|
378 |
}
|
sl@0
|
379 |
|
sl@0
|
380 |
void CT_FileManData::DoCmdNewL(const TDesC& aSection)
|
sl@0
|
381 |
{
|
sl@0
|
382 |
DoCleanup();
|
sl@0
|
383 |
TBool useObserver = EFalse;
|
sl@0
|
384 |
|
sl@0
|
385 |
GET_OPTIONAL_BOOL_PARAMETER(KUseObserver, aSection, useObserver);
|
sl@0
|
386 |
|
sl@0
|
387 |
TPtrC rfsObjectName;
|
sl@0
|
388 |
RFs* rfsObject = NULL;
|
sl@0
|
389 |
if (GET_MANDATORY_STRING_PARAMETER(KRFsObject, aSection, rfsObjectName))
|
sl@0
|
390 |
{
|
sl@0
|
391 |
rfsObject = (RFs*)GetDataObjectL(rfsObjectName);
|
sl@0
|
392 |
}
|
sl@0
|
393 |
|
sl@0
|
394 |
TInt err = KErrNone;
|
sl@0
|
395 |
if(useObserver)
|
sl@0
|
396 |
{
|
sl@0
|
397 |
INFO_PRINTF1(_L("CFileMan::NewL(RFs, MFileManObserver)"));
|
sl@0
|
398 |
TRAP(err, iFileMan = CFileMan::NewL(*rfsObject, iFileManObserver));
|
sl@0
|
399 |
}
|
sl@0
|
400 |
else
|
sl@0
|
401 |
{
|
sl@0
|
402 |
INFO_PRINTF1(_L("CFileMan::NewL(RFs)"));
|
sl@0
|
403 |
TRAP(err, iFileMan = CFileMan::NewL(*rfsObject));
|
sl@0
|
404 |
}
|
sl@0
|
405 |
if (err != KErrNone)
|
sl@0
|
406 |
{
|
sl@0
|
407 |
ERR_PRINTF1(_L("CFileMan object is not created"));
|
sl@0
|
408 |
SetBlockResult(EFail);
|
sl@0
|
409 |
}
|
sl@0
|
410 |
}
|
sl@0
|
411 |
|
sl@0
|
412 |
void CT_FileManData::DoCmdAttribsL(const TDesC& aSection, TInt aAsyncErrorIndex)
|
sl@0
|
413 |
{
|
sl@0
|
414 |
INFO_PRINTF1(_L("Setting attributes!"));
|
sl@0
|
415 |
|
sl@0
|
416 |
TBool dataOk = ETrue;
|
sl@0
|
417 |
|
sl@0
|
418 |
//Reading path for file or files.
|
sl@0
|
419 |
TPtrC fileName;
|
sl@0
|
420 |
if (!GET_MANDATORY_STRING_PARAMETER(KFileName, aSection, fileName))
|
sl@0
|
421 |
{
|
sl@0
|
422 |
dataOk = EFalse;
|
sl@0
|
423 |
}
|
sl@0
|
424 |
|
sl@0
|
425 |
//Reading new TTime from ini
|
sl@0
|
426 |
TPtrC inputTime;
|
sl@0
|
427 |
TTime iniTime;
|
sl@0
|
428 |
if(GET_MANDATORY_STRING_PARAMETER(KTime, aSection, inputTime))
|
sl@0
|
429 |
{
|
sl@0
|
430 |
TInt err = iniTime.Set(inputTime);
|
sl@0
|
431 |
if (err != KErrNone)
|
sl@0
|
432 |
{
|
sl@0
|
433 |
ERR_PRINTF3(_L("Cannot convert (%S) to time. Error: %d"), &inputTime ,err);
|
sl@0
|
434 |
dataOk = EFalse;
|
sl@0
|
435 |
SetBlockResult(EFail);
|
sl@0
|
436 |
}
|
sl@0
|
437 |
}
|
sl@0
|
438 |
else
|
sl@0
|
439 |
{
|
sl@0
|
440 |
dataOk = EFalse;
|
sl@0
|
441 |
}
|
sl@0
|
442 |
|
sl@0
|
443 |
//Reading Async parameter (True/False)
|
sl@0
|
444 |
TBool async = EFalse;
|
sl@0
|
445 |
if(!GET_MANDATORY_BOOL_PARAMETER(KAsync, aSection, async))
|
sl@0
|
446 |
{
|
sl@0
|
447 |
dataOk = EFalse;
|
sl@0
|
448 |
}
|
sl@0
|
449 |
//Read SetMask attribute
|
sl@0
|
450 |
TUint setMask;
|
sl@0
|
451 |
if(!FileserverUtil::GetAttMask(*this, aSection, KSetMask(), setMask))
|
sl@0
|
452 |
{
|
sl@0
|
453 |
dataOk = EFalse;
|
sl@0
|
454 |
}
|
sl@0
|
455 |
|
sl@0
|
456 |
//Read ClearMask attribute
|
sl@0
|
457 |
TUint clearMask;
|
sl@0
|
458 |
if(!FileserverUtil::GetAttMask(*this, aSection, KClearMask(), clearMask))
|
sl@0
|
459 |
{
|
sl@0
|
460 |
dataOk = EFalse;
|
sl@0
|
461 |
}
|
sl@0
|
462 |
|
sl@0
|
463 |
//Read operation TSwitch
|
sl@0
|
464 |
TUint operation;
|
sl@0
|
465 |
if(!GetOperationFromConfig(KOperation(), aSection, operation))
|
sl@0
|
466 |
{
|
sl@0
|
467 |
dataOk = EFalse;
|
sl@0
|
468 |
}
|
sl@0
|
469 |
if(dataOk)
|
sl@0
|
470 |
{
|
sl@0
|
471 |
TInt error = KErrNone;
|
sl@0
|
472 |
if(async)
|
sl@0
|
473 |
{
|
sl@0
|
474 |
CActiveCallback* active = CActiveCallback::NewLC(*this);
|
sl@0
|
475 |
iAttribs.AppendL(active);
|
sl@0
|
476 |
CleanupStack::Pop(active);
|
sl@0
|
477 |
error = iFileMan->Attribs(fileName, setMask, clearMask, iniTime, operation, active->iStatus);
|
sl@0
|
478 |
if(error == KErrNone)
|
sl@0
|
479 |
{
|
sl@0
|
480 |
active->Activate(aAsyncErrorIndex);
|
sl@0
|
481 |
iAsyncErrorIndex = aAsyncErrorIndex;
|
sl@0
|
482 |
iAsyncCall = ETrue;
|
sl@0
|
483 |
IncOutstanding();
|
sl@0
|
484 |
}
|
sl@0
|
485 |
}
|
sl@0
|
486 |
else
|
sl@0
|
487 |
{
|
sl@0
|
488 |
error = iFileMan->Attribs(fileName, setMask, clearMask, iniTime, operation);
|
sl@0
|
489 |
}
|
sl@0
|
490 |
if (error != KErrNone)
|
sl@0
|
491 |
{
|
sl@0
|
492 |
ERR_PRINTF3(_L("Attribs(%S) Error: %d"), &fileName, error);
|
sl@0
|
493 |
SetError(error);
|
sl@0
|
494 |
}
|
sl@0
|
495 |
else
|
sl@0
|
496 |
{
|
sl@0
|
497 |
INFO_PRINTF2(_L("Attribs operation on (%S) is successfull!"), &fileName);
|
sl@0
|
498 |
}
|
sl@0
|
499 |
}
|
sl@0
|
500 |
}
|
sl@0
|
501 |
void CT_FileManData::DoCmdCopyL(const TDesC& aSection, TInt aAsyncErrorIndex)
|
sl@0
|
502 |
{
|
sl@0
|
503 |
TBool clearHistory = EFalse;
|
sl@0
|
504 |
GET_OPTIONAL_BOOL_PARAMETER(KClearHistory, aSection, clearHistory);
|
sl@0
|
505 |
if(clearHistory)
|
sl@0
|
506 |
{
|
sl@0
|
507 |
ClearHistory();
|
sl@0
|
508 |
}
|
sl@0
|
509 |
TBool setTControl = EFalse;
|
sl@0
|
510 |
GET_OPTIONAL_BOOL_PARAMETER(KSetTcontrol, aSection, setTControl);
|
sl@0
|
511 |
if(setTControl)
|
sl@0
|
512 |
{
|
sl@0
|
513 |
ReadTControl(aSection);
|
sl@0
|
514 |
}
|
sl@0
|
515 |
|
sl@0
|
516 |
INFO_PRINTF1(_L("Coping files!"));
|
sl@0
|
517 |
TBool dataOk = ETrue;
|
sl@0
|
518 |
TPtrC oldName;
|
sl@0
|
519 |
TPtrC rfileObjectName;
|
sl@0
|
520 |
RFile* rfileObject = NULL;
|
sl@0
|
521 |
|
sl@0
|
522 |
if (!GET_OPTIONAL_STRING_PARAMETER(KOldName, aSection, oldName))
|
sl@0
|
523 |
{
|
sl@0
|
524 |
if (GET_OPTIONAL_STRING_PARAMETER(KRFileObject, aSection, rfileObjectName))
|
sl@0
|
525 |
{
|
sl@0
|
526 |
rfileObject = (RFile*)GetDataObjectL(rfileObjectName);
|
sl@0
|
527 |
}
|
sl@0
|
528 |
else
|
sl@0
|
529 |
{
|
sl@0
|
530 |
ERR_PRINTF1(_L("Cannot read \"oldname\" or \"rfileObject\" arguments!"));
|
sl@0
|
531 |
SetBlockResult(EFail);
|
sl@0
|
532 |
dataOk = EFalse;
|
sl@0
|
533 |
}
|
sl@0
|
534 |
}
|
sl@0
|
535 |
|
sl@0
|
536 |
TPtrC newName;
|
sl@0
|
537 |
if (!GET_MANDATORY_STRING_PARAMETER(KNewName, aSection, newName))
|
sl@0
|
538 |
{
|
sl@0
|
539 |
dataOk = EFalse;
|
sl@0
|
540 |
}
|
sl@0
|
541 |
|
sl@0
|
542 |
TUint operation;
|
sl@0
|
543 |
if (!GetOperationFromConfig(KOperation, aSection, operation))
|
sl@0
|
544 |
{
|
sl@0
|
545 |
dataOk = EFalse;
|
sl@0
|
546 |
}
|
sl@0
|
547 |
TBool async;
|
sl@0
|
548 |
if (!GET_MANDATORY_BOOL_PARAMETER(KAsync, aSection, async))
|
sl@0
|
549 |
{
|
sl@0
|
550 |
dataOk = EFalse;
|
sl@0
|
551 |
}
|
sl@0
|
552 |
|
sl@0
|
553 |
if(dataOk)
|
sl@0
|
554 |
{
|
sl@0
|
555 |
TInt error = KErrNone;
|
sl@0
|
556 |
if(async)
|
sl@0
|
557 |
{
|
sl@0
|
558 |
CActiveCallback* active = CActiveCallback::NewLC(*this);
|
sl@0
|
559 |
iCopy.AppendL(active);
|
sl@0
|
560 |
CleanupStack::Pop(active);
|
sl@0
|
561 |
if(rfileObject)
|
sl@0
|
562 |
{
|
sl@0
|
563 |
error = iFileMan->Copy(*rfileObject, newName, operation, active->iStatus);
|
sl@0
|
564 |
}
|
sl@0
|
565 |
else
|
sl@0
|
566 |
{
|
sl@0
|
567 |
error = iFileMan->Copy(oldName, newName, operation, active->iStatus);
|
sl@0
|
568 |
}
|
sl@0
|
569 |
if(error == KErrNone)
|
sl@0
|
570 |
{
|
sl@0
|
571 |
active->Activate(aAsyncErrorIndex);
|
sl@0
|
572 |
iAsyncErrorIndex = aAsyncErrorIndex;
|
sl@0
|
573 |
iAsyncCall = ETrue;
|
sl@0
|
574 |
IncOutstanding();
|
sl@0
|
575 |
}
|
sl@0
|
576 |
}
|
sl@0
|
577 |
else
|
sl@0
|
578 |
{
|
sl@0
|
579 |
if(rfileObject)
|
sl@0
|
580 |
{
|
sl@0
|
581 |
error = iFileMan->Copy(*rfileObject, newName, operation);
|
sl@0
|
582 |
}
|
sl@0
|
583 |
else
|
sl@0
|
584 |
{
|
sl@0
|
585 |
error = iFileMan->Copy(oldName, newName, operation);
|
sl@0
|
586 |
}
|
sl@0
|
587 |
}
|
sl@0
|
588 |
if (error != KErrNone)
|
sl@0
|
589 |
{
|
sl@0
|
590 |
ERR_PRINTF2(_L("Copy(), Error: %d"), error);
|
sl@0
|
591 |
SetError(error);
|
sl@0
|
592 |
}
|
sl@0
|
593 |
else
|
sl@0
|
594 |
{
|
sl@0
|
595 |
INFO_PRINTF1(_L("Copy() operation is successfully!"));
|
sl@0
|
596 |
}
|
sl@0
|
597 |
}
|
sl@0
|
598 |
}
|
sl@0
|
599 |
|
sl@0
|
600 |
void CT_FileManData::DoCmdDeleteL(const TDesC& aSection, TInt aAsyncErrorIndex)
|
sl@0
|
601 |
{
|
sl@0
|
602 |
TBool clearHistory = EFalse;
|
sl@0
|
603 |
GET_OPTIONAL_BOOL_PARAMETER(KClearHistory, aSection, clearHistory);
|
sl@0
|
604 |
if(clearHistory)
|
sl@0
|
605 |
{
|
sl@0
|
606 |
ClearHistory();
|
sl@0
|
607 |
}
|
sl@0
|
608 |
TBool setTControl = EFalse;
|
sl@0
|
609 |
GET_OPTIONAL_BOOL_PARAMETER(KSetTcontrol, aSection, setTControl);
|
sl@0
|
610 |
if(setTControl)
|
sl@0
|
611 |
{
|
sl@0
|
612 |
ReadTControl(aSection);
|
sl@0
|
613 |
}
|
sl@0
|
614 |
|
sl@0
|
615 |
INFO_PRINTF1(_L("Deleting files!"));
|
sl@0
|
616 |
|
sl@0
|
617 |
TBool dataOk = ETrue;
|
sl@0
|
618 |
TPtrC fileName;
|
sl@0
|
619 |
if (GET_MANDATORY_STRING_PARAMETER(KFileName, aSection, fileName))
|
sl@0
|
620 |
{
|
sl@0
|
621 |
if(fileName == KNullDesCStr)
|
sl@0
|
622 |
{
|
sl@0
|
623 |
fileName.Set(KNullDesC);
|
sl@0
|
624 |
}
|
sl@0
|
625 |
}
|
sl@0
|
626 |
else
|
sl@0
|
627 |
{
|
sl@0
|
628 |
dataOk = EFalse;
|
sl@0
|
629 |
}
|
sl@0
|
630 |
TUint operation;
|
sl@0
|
631 |
if(!GetOperationFromConfig(KOperation, aSection, operation))
|
sl@0
|
632 |
{
|
sl@0
|
633 |
dataOk = EFalse;
|
sl@0
|
634 |
}
|
sl@0
|
635 |
TBool async = EFalse;
|
sl@0
|
636 |
if (!GET_MANDATORY_BOOL_PARAMETER(KAsync, aSection, async))
|
sl@0
|
637 |
{
|
sl@0
|
638 |
dataOk = EFalse;
|
sl@0
|
639 |
}
|
sl@0
|
640 |
if(dataOk)
|
sl@0
|
641 |
{
|
sl@0
|
642 |
TInt error = KErrNone;
|
sl@0
|
643 |
if(async)
|
sl@0
|
644 |
{
|
sl@0
|
645 |
CActiveCallback* active = CActiveCallback::NewLC(*this);
|
sl@0
|
646 |
iDelete.AppendL(active);
|
sl@0
|
647 |
CleanupStack::Pop(active);
|
sl@0
|
648 |
error = iFileMan->Delete(fileName, operation, active->iStatus);
|
sl@0
|
649 |
if (error == KErrNone)
|
sl@0
|
650 |
{
|
sl@0
|
651 |
active->Activate(aAsyncErrorIndex);
|
sl@0
|
652 |
iAsyncErrorIndex = aAsyncErrorIndex;
|
sl@0
|
653 |
iAsyncCall = ETrue;
|
sl@0
|
654 |
IncOutstanding();
|
sl@0
|
655 |
}
|
sl@0
|
656 |
}
|
sl@0
|
657 |
else
|
sl@0
|
658 |
{
|
sl@0
|
659 |
error = iFileMan->Delete(fileName, operation);
|
sl@0
|
660 |
}
|
sl@0
|
661 |
|
sl@0
|
662 |
if (error != KErrNone)
|
sl@0
|
663 |
{
|
sl@0
|
664 |
ERR_PRINTF3(_L("Delete (%S), Error: %d"), &fileName, error);
|
sl@0
|
665 |
SetError(error);
|
sl@0
|
666 |
}
|
sl@0
|
667 |
else
|
sl@0
|
668 |
{
|
sl@0
|
669 |
INFO_PRINTF2(_L("Delete (%S) operation is successfully!"), &fileName);
|
sl@0
|
670 |
}
|
sl@0
|
671 |
}
|
sl@0
|
672 |
}
|
sl@0
|
673 |
|
sl@0
|
674 |
void CT_FileManData::DoCmdMoveL(const TDesC& aSection, TInt aAsyncErrorIndex)
|
sl@0
|
675 |
{
|
sl@0
|
676 |
TBool clearHistory = EFalse;
|
sl@0
|
677 |
GET_OPTIONAL_BOOL_PARAMETER(KClearHistory, aSection, clearHistory);
|
sl@0
|
678 |
if(clearHistory)
|
sl@0
|
679 |
{
|
sl@0
|
680 |
ClearHistory();
|
sl@0
|
681 |
}
|
sl@0
|
682 |
TBool setTControl = EFalse;
|
sl@0
|
683 |
GET_OPTIONAL_BOOL_PARAMETER(KSetTcontrol, aSection, setTControl);
|
sl@0
|
684 |
if(setTControl)
|
sl@0
|
685 |
{
|
sl@0
|
686 |
ReadTControl(aSection);
|
sl@0
|
687 |
}
|
sl@0
|
688 |
|
sl@0
|
689 |
INFO_PRINTF1(_L("Moving files!"));
|
sl@0
|
690 |
|
sl@0
|
691 |
TBool dataOk = ETrue;
|
sl@0
|
692 |
TPtrC fileFrom;
|
sl@0
|
693 |
if (!GET_MANDATORY_STRING_PARAMETER(KFileFrom, aSection, fileFrom))
|
sl@0
|
694 |
{
|
sl@0
|
695 |
dataOk = EFalse;
|
sl@0
|
696 |
}
|
sl@0
|
697 |
|
sl@0
|
698 |
TPtrC fileTo;
|
sl@0
|
699 |
if (!GET_MANDATORY_STRING_PARAMETER(KFileTo, aSection, fileTo))
|
sl@0
|
700 |
{
|
sl@0
|
701 |
dataOk = EFalse;
|
sl@0
|
702 |
}
|
sl@0
|
703 |
TBool async;
|
sl@0
|
704 |
if (!GET_MANDATORY_BOOL_PARAMETER(KAsync, aSection, async))
|
sl@0
|
705 |
{
|
sl@0
|
706 |
dataOk = EFalse;
|
sl@0
|
707 |
}
|
sl@0
|
708 |
TUint operation;
|
sl@0
|
709 |
if (!GetOperationFromConfig(KOperation, aSection, operation))
|
sl@0
|
710 |
{
|
sl@0
|
711 |
dataOk = EFalse;
|
sl@0
|
712 |
}
|
sl@0
|
713 |
if(dataOk)
|
sl@0
|
714 |
{
|
sl@0
|
715 |
TInt error = KErrNone;
|
sl@0
|
716 |
if(async)
|
sl@0
|
717 |
{
|
sl@0
|
718 |
CActiveCallback* active = CActiveCallback::NewLC(*this);
|
sl@0
|
719 |
iMove.AppendL(active);
|
sl@0
|
720 |
CleanupStack::Pop(active);
|
sl@0
|
721 |
error = iFileMan->Move(fileFrom, fileTo, operation, active->iStatus);
|
sl@0
|
722 |
if(error == KErrNone)
|
sl@0
|
723 |
{
|
sl@0
|
724 |
active->Activate(aAsyncErrorIndex);
|
sl@0
|
725 |
iAsyncErrorIndex = aAsyncErrorIndex;
|
sl@0
|
726 |
iAsyncCall = ETrue;
|
sl@0
|
727 |
IncOutstanding();
|
sl@0
|
728 |
}
|
sl@0
|
729 |
}
|
sl@0
|
730 |
else
|
sl@0
|
731 |
{
|
sl@0
|
732 |
error = iFileMan->Move(fileFrom, fileTo, operation);
|
sl@0
|
733 |
}
|
sl@0
|
734 |
if (error != KErrNone)
|
sl@0
|
735 |
{
|
sl@0
|
736 |
ERR_PRINTF2(_L("Move(), Error: %d"), error);
|
sl@0
|
737 |
SetError(error);
|
sl@0
|
738 |
}
|
sl@0
|
739 |
else
|
sl@0
|
740 |
{
|
sl@0
|
741 |
INFO_PRINTF1(_L("Move() operation is successfully!"));
|
sl@0
|
742 |
}
|
sl@0
|
743 |
}
|
sl@0
|
744 |
}
|
sl@0
|
745 |
|
sl@0
|
746 |
void CT_FileManData::DoCmdRenameL(const TDesC& aSection, TInt aAsyncErrorIndex)
|
sl@0
|
747 |
{
|
sl@0
|
748 |
TBool clearHistory = EFalse;
|
sl@0
|
749 |
GET_OPTIONAL_BOOL_PARAMETER(KClearHistory, aSection, clearHistory);
|
sl@0
|
750 |
if(clearHistory)
|
sl@0
|
751 |
{
|
sl@0
|
752 |
ClearHistory();
|
sl@0
|
753 |
}
|
sl@0
|
754 |
TBool setTControl = EFalse;
|
sl@0
|
755 |
GET_OPTIONAL_BOOL_PARAMETER(KSetTcontrol, aSection, setTControl);
|
sl@0
|
756 |
if(setTControl)
|
sl@0
|
757 |
{
|
sl@0
|
758 |
ReadTControl(aSection);
|
sl@0
|
759 |
}
|
sl@0
|
760 |
INFO_PRINTF1(_L("Renaming files!"));
|
sl@0
|
761 |
|
sl@0
|
762 |
TBool dataOk = ETrue;
|
sl@0
|
763 |
|
sl@0
|
764 |
//Reading Old Name
|
sl@0
|
765 |
TPtrC oldName;
|
sl@0
|
766 |
if (!GET_MANDATORY_STRING_PARAMETER(KOldName, aSection, oldName))
|
sl@0
|
767 |
{
|
sl@0
|
768 |
dataOk = EFalse;
|
sl@0
|
769 |
}
|
sl@0
|
770 |
|
sl@0
|
771 |
//Reading New Name
|
sl@0
|
772 |
TPtrC newName;
|
sl@0
|
773 |
if (!GET_MANDATORY_STRING_PARAMETER(KNewName, aSection, newName))
|
sl@0
|
774 |
{
|
sl@0
|
775 |
dataOk = EFalse;
|
sl@0
|
776 |
}
|
sl@0
|
777 |
|
sl@0
|
778 |
//Rading TSwitch - Operation
|
sl@0
|
779 |
TUint operation;
|
sl@0
|
780 |
if (!GetOperationFromConfig(KOperation(), aSection, operation))
|
sl@0
|
781 |
{
|
sl@0
|
782 |
dataOk = EFalse;
|
sl@0
|
783 |
}
|
sl@0
|
784 |
//Reading async
|
sl@0
|
785 |
TBool async;
|
sl@0
|
786 |
if (!GET_MANDATORY_BOOL_PARAMETER(KAsync, aSection, async))
|
sl@0
|
787 |
{
|
sl@0
|
788 |
dataOk = EFalse;
|
sl@0
|
789 |
}
|
sl@0
|
790 |
if(dataOk)
|
sl@0
|
791 |
{
|
sl@0
|
792 |
TInt error = KErrNone;
|
sl@0
|
793 |
if(async)
|
sl@0
|
794 |
{
|
sl@0
|
795 |
CActiveCallback* active = CActiveCallback::NewLC(*this);
|
sl@0
|
796 |
iRename.AppendL(active);
|
sl@0
|
797 |
CleanupStack::Pop(active);
|
sl@0
|
798 |
error = iFileMan->Rename(oldName, newName, operation, active->iStatus);
|
sl@0
|
799 |
if(error == KErrNone)
|
sl@0
|
800 |
{
|
sl@0
|
801 |
active->Activate(aAsyncErrorIndex);
|
sl@0
|
802 |
iAsyncErrorIndex = aAsyncErrorIndex;
|
sl@0
|
803 |
iAsyncCall = ETrue;
|
sl@0
|
804 |
IncOutstanding();
|
sl@0
|
805 |
}
|
sl@0
|
806 |
}
|
sl@0
|
807 |
else
|
sl@0
|
808 |
{
|
sl@0
|
809 |
error = iFileMan->Rename(oldName, newName, operation);
|
sl@0
|
810 |
}
|
sl@0
|
811 |
if (error != KErrNone)
|
sl@0
|
812 |
{
|
sl@0
|
813 |
ERR_PRINTF2(_L("Rename() Error: %d"), error);
|
sl@0
|
814 |
SetError(error);
|
sl@0
|
815 |
}
|
sl@0
|
816 |
else
|
sl@0
|
817 |
{
|
sl@0
|
818 |
INFO_PRINTF1(_L("Rename() operation is successfully!"));
|
sl@0
|
819 |
}
|
sl@0
|
820 |
}
|
sl@0
|
821 |
}
|
sl@0
|
822 |
|
sl@0
|
823 |
void CT_FileManData::DoCmdRmDirL(const TDesC& aSection, TInt aAsyncErrorIndex)
|
sl@0
|
824 |
{
|
sl@0
|
825 |
INFO_PRINTF1(_L("Removing directory!"));
|
sl@0
|
826 |
|
sl@0
|
827 |
TBool dataOk = ETrue;
|
sl@0
|
828 |
TPtrC path;
|
sl@0
|
829 |
|
sl@0
|
830 |
if (!GET_MANDATORY_STRING_PARAMETER(KPath, aSection, path))
|
sl@0
|
831 |
{
|
sl@0
|
832 |
dataOk = EFalse;
|
sl@0
|
833 |
}
|
sl@0
|
834 |
|
sl@0
|
835 |
TBool async = EFalse;
|
sl@0
|
836 |
if (!GET_MANDATORY_BOOL_PARAMETER(KAsync, aSection, async))
|
sl@0
|
837 |
{
|
sl@0
|
838 |
dataOk = EFalse;
|
sl@0
|
839 |
}
|
sl@0
|
840 |
|
sl@0
|
841 |
if(dataOk)
|
sl@0
|
842 |
{
|
sl@0
|
843 |
TInt error = KErrNone;
|
sl@0
|
844 |
if(async)
|
sl@0
|
845 |
{
|
sl@0
|
846 |
CActiveCallback* active = CActiveCallback::NewLC(*this);
|
sl@0
|
847 |
iRmDir.AppendL(active);
|
sl@0
|
848 |
CleanupStack::Pop(active);
|
sl@0
|
849 |
error = iFileMan->RmDir(path, active->iStatus);
|
sl@0
|
850 |
if(error == KErrNone)
|
sl@0
|
851 |
{
|
sl@0
|
852 |
active->Activate(aAsyncErrorIndex);
|
sl@0
|
853 |
iAsyncErrorIndex = aAsyncErrorIndex;
|
sl@0
|
854 |
iAsyncCall = ETrue;
|
sl@0
|
855 |
IncOutstanding();
|
sl@0
|
856 |
}
|
sl@0
|
857 |
}
|
sl@0
|
858 |
else
|
sl@0
|
859 |
{
|
sl@0
|
860 |
error = iFileMan->RmDir(path);
|
sl@0
|
861 |
}
|
sl@0
|
862 |
if (error != KErrNone)
|
sl@0
|
863 |
{
|
sl@0
|
864 |
ERR_PRINTF3(_L("RmDir(%S), Error: %d"), &path, error);
|
sl@0
|
865 |
SetError(error);
|
sl@0
|
866 |
}
|
sl@0
|
867 |
else
|
sl@0
|
868 |
{
|
sl@0
|
869 |
INFO_PRINTF2(_L("Callled RmDir(%S)"), &path);
|
sl@0
|
870 |
}
|
sl@0
|
871 |
}
|
sl@0
|
872 |
}
|
sl@0
|
873 |
|
sl@0
|
874 |
void CT_FileManData::DoCmdSetObserver()
|
sl@0
|
875 |
{
|
sl@0
|
876 |
INFO_PRINTF1(_L("Setting observer"));
|
sl@0
|
877 |
|
sl@0
|
878 |
iFileMan->SetObserver(this);
|
sl@0
|
879 |
}
|
sl@0
|
880 |
|
sl@0
|
881 |
void CT_FileManData::DoCmdCurrentAction(const TDesC& aSection)
|
sl@0
|
882 |
{
|
sl@0
|
883 |
TBool readHistory = EFalse;
|
sl@0
|
884 |
GET_OPTIONAL_BOOL_PARAMETER(KReadHistory, aSection, readHistory);
|
sl@0
|
885 |
CFileMan::TAction currentAction = CFileMan::ENone;
|
sl@0
|
886 |
TBool found = ETrue;
|
sl@0
|
887 |
if(readHistory)
|
sl@0
|
888 |
{
|
sl@0
|
889 |
/** Get needed history array **/
|
sl@0
|
890 |
RPointerArray<THistoryData>* history = GetHistoryDataByType(aSection);
|
sl@0
|
891 |
if(history)
|
sl@0
|
892 |
{
|
sl@0
|
893 |
CFileMan::TAction expectedAction;
|
sl@0
|
894 |
found = EFalse;
|
sl@0
|
895 |
if(GetActionFromConfig(KCurrentAction(), aSection, expectedAction))
|
sl@0
|
896 |
{
|
sl@0
|
897 |
CFileMan::TAction action;
|
sl@0
|
898 |
TInt count = history->Count();
|
sl@0
|
899 |
/** Search for expected TAction in history **/
|
sl@0
|
900 |
for(TInt i = 0; (i < count) && (!found); i++)
|
sl@0
|
901 |
{
|
sl@0
|
902 |
action = ((*history)[i])->iCurrentAction;
|
sl@0
|
903 |
if( action == expectedAction)
|
sl@0
|
904 |
{
|
sl@0
|
905 |
currentAction = action;
|
sl@0
|
906 |
found = ETrue;
|
sl@0
|
907 |
}
|
sl@0
|
908 |
}
|
sl@0
|
909 |
if(!found)
|
sl@0
|
910 |
{
|
sl@0
|
911 |
TPtrC expectedActionStr;
|
sl@0
|
912 |
ConvertActionToString(expectedAction, expectedActionStr);
|
sl@0
|
913 |
ERR_PRINTF2(_L("CurrentAction() %S not found in history!"), &expectedActionStr);
|
sl@0
|
914 |
SetBlockResult(EFail);
|
sl@0
|
915 |
}
|
sl@0
|
916 |
}
|
sl@0
|
917 |
else
|
sl@0
|
918 |
{
|
sl@0
|
919 |
ERR_PRINTF2(_L("Cannot read %S"), &KCurrentAction());
|
sl@0
|
920 |
SetBlockResult(EFail);
|
sl@0
|
921 |
}
|
sl@0
|
922 |
}
|
sl@0
|
923 |
}
|
sl@0
|
924 |
else
|
sl@0
|
925 |
{
|
sl@0
|
926 |
currentAction = iFileMan->CurrentAction();
|
sl@0
|
927 |
}
|
sl@0
|
928 |
|
sl@0
|
929 |
if(found)
|
sl@0
|
930 |
{
|
sl@0
|
931 |
TPtrC actionStr;
|
sl@0
|
932 |
ConvertActionToString(currentAction, actionStr);
|
sl@0
|
933 |
|
sl@0
|
934 |
CFileMan::TAction expectedAction;
|
sl@0
|
935 |
if(GetActionFromConfig(KCurrentAction(), aSection, expectedAction))
|
sl@0
|
936 |
{
|
sl@0
|
937 |
TPtrC expectedActionStr;
|
sl@0
|
938 |
ConvertActionToString(expectedAction, expectedActionStr);
|
sl@0
|
939 |
if(expectedAction != currentAction)
|
sl@0
|
940 |
{
|
sl@0
|
941 |
ERR_PRINTF3(_L("CurrentAction(): %S != %S Expected Action"), &actionStr, &expectedActionStr);
|
sl@0
|
942 |
SetBlockResult(EFail);
|
sl@0
|
943 |
}
|
sl@0
|
944 |
else
|
sl@0
|
945 |
{
|
sl@0
|
946 |
INFO_PRINTF3(_L("CurrentAction(): %S == %S Expected Action"), &actionStr, &expectedActionStr);
|
sl@0
|
947 |
}
|
sl@0
|
948 |
}
|
sl@0
|
949 |
else
|
sl@0
|
950 |
{
|
sl@0
|
951 |
INFO_PRINTF2(_L("CurrentAction: %S"), &actionStr);
|
sl@0
|
952 |
}
|
sl@0
|
953 |
}
|
sl@0
|
954 |
}
|
sl@0
|
955 |
|
sl@0
|
956 |
void CT_FileManData::DoCmdGetCurrentTarget(const TDesC& aSection)
|
sl@0
|
957 |
{
|
sl@0
|
958 |
TBool readHistory = EFalse;
|
sl@0
|
959 |
GET_OPTIONAL_BOOL_PARAMETER(KReadHistory, aSection, readHistory);
|
sl@0
|
960 |
TFileName target;
|
sl@0
|
961 |
TBool found = ETrue;
|
sl@0
|
962 |
if(readHistory)
|
sl@0
|
963 |
{
|
sl@0
|
964 |
/** Get needed history array **/
|
sl@0
|
965 |
RPointerArray<THistoryData>* history = GetHistoryDataByType(aSection);
|
sl@0
|
966 |
if(history)
|
sl@0
|
967 |
{
|
sl@0
|
968 |
TPtrC expectedTarget;
|
sl@0
|
969 |
found = EFalse;
|
sl@0
|
970 |
if(GET_MANDATORY_STRING_PARAMETER(KTarget, aSection, expectedTarget))
|
sl@0
|
971 |
{
|
sl@0
|
972 |
TInt count = history->Count();
|
sl@0
|
973 |
/** Search for expected target in history **/
|
sl@0
|
974 |
for(TInt i = 0; (!found) && (i < count); i++)
|
sl@0
|
975 |
{
|
sl@0
|
976 |
if( ((*history)[i])->iCurrentTarget == expectedTarget)
|
sl@0
|
977 |
{
|
sl@0
|
978 |
target = ((*history)[i])->iCurrentTarget;
|
sl@0
|
979 |
found = ETrue;
|
sl@0
|
980 |
}
|
sl@0
|
981 |
}
|
sl@0
|
982 |
if(!found)
|
sl@0
|
983 |
{
|
sl@0
|
984 |
ERR_PRINTF2(_L("GetCurrentTarget() %S not found in history!"), &expectedTarget);
|
sl@0
|
985 |
SetBlockResult(EFail);
|
sl@0
|
986 |
}
|
sl@0
|
987 |
}
|
sl@0
|
988 |
}
|
sl@0
|
989 |
}
|
sl@0
|
990 |
else
|
sl@0
|
991 |
{
|
sl@0
|
992 |
iFileMan->GetCurrentTarget(target);
|
sl@0
|
993 |
}
|
sl@0
|
994 |
if(found)
|
sl@0
|
995 |
{
|
sl@0
|
996 |
TPtrC expectedTarget;
|
sl@0
|
997 |
if(GET_OPTIONAL_STRING_PARAMETER(KTarget, aSection, expectedTarget))
|
sl@0
|
998 |
{
|
sl@0
|
999 |
if(target == expectedTarget)
|
sl@0
|
1000 |
{
|
sl@0
|
1001 |
INFO_PRINTF3(_L("GetCurrentTarget() %S == %S ExpectedResult"), &target, &expectedTarget);
|
sl@0
|
1002 |
}
|
sl@0
|
1003 |
else
|
sl@0
|
1004 |
{
|
sl@0
|
1005 |
ERR_PRINTF3(_L("GetCurrentTarget() %S != %S ExpectedResult"), &target, &expectedTarget);
|
sl@0
|
1006 |
SetBlockResult(EFail);
|
sl@0
|
1007 |
}
|
sl@0
|
1008 |
|
sl@0
|
1009 |
}
|
sl@0
|
1010 |
else
|
sl@0
|
1011 |
{
|
sl@0
|
1012 |
INFO_PRINTF2(_L("GetCurrentTarget() %S"), &target);
|
sl@0
|
1013 |
}
|
sl@0
|
1014 |
}
|
sl@0
|
1015 |
}
|
sl@0
|
1016 |
void CT_FileManData::DoCmdGetCurrentSource(const TDesC& aSection)
|
sl@0
|
1017 |
{
|
sl@0
|
1018 |
TBool readHistory = EFalse;
|
sl@0
|
1019 |
GET_OPTIONAL_BOOL_PARAMETER(KReadHistory, aSection, readHistory);
|
sl@0
|
1020 |
TFileName source;
|
sl@0
|
1021 |
TBool found = ETrue;
|
sl@0
|
1022 |
if(readHistory)
|
sl@0
|
1023 |
{
|
sl@0
|
1024 |
/** Get needed history array **/
|
sl@0
|
1025 |
RPointerArray<THistoryData>* history = GetHistoryDataByType(aSection);
|
sl@0
|
1026 |
if(history)
|
sl@0
|
1027 |
{
|
sl@0
|
1028 |
TPtrC expectedSource;
|
sl@0
|
1029 |
found = EFalse;
|
sl@0
|
1030 |
if(GET_MANDATORY_STRING_PARAMETER(KSource, aSection, expectedSource))
|
sl@0
|
1031 |
{
|
sl@0
|
1032 |
TInt count = history->Count();
|
sl@0
|
1033 |
/** Search for expected source in history **/
|
sl@0
|
1034 |
for(TInt i = 0; (!found) && (i < count); i++)
|
sl@0
|
1035 |
{
|
sl@0
|
1036 |
if( (*history)[i]->iCurrentSource == expectedSource)
|
sl@0
|
1037 |
{
|
sl@0
|
1038 |
source = (*history)[i]->iCurrentSource;
|
sl@0
|
1039 |
found = ETrue;
|
sl@0
|
1040 |
}
|
sl@0
|
1041 |
}
|
sl@0
|
1042 |
if(!found)
|
sl@0
|
1043 |
{
|
sl@0
|
1044 |
ERR_PRINTF2(_L("GetCurrentSource() %S not found in history!"), &expectedSource);
|
sl@0
|
1045 |
SetBlockResult(EFail);
|
sl@0
|
1046 |
}
|
sl@0
|
1047 |
}
|
sl@0
|
1048 |
}
|
sl@0
|
1049 |
}
|
sl@0
|
1050 |
else
|
sl@0
|
1051 |
{
|
sl@0
|
1052 |
iFileMan->GetCurrentSource(source);
|
sl@0
|
1053 |
}
|
sl@0
|
1054 |
|
sl@0
|
1055 |
if (found)
|
sl@0
|
1056 |
{
|
sl@0
|
1057 |
TPtrC expectedSource;
|
sl@0
|
1058 |
if(GET_OPTIONAL_STRING_PARAMETER(KSource, aSection, expectedSource))
|
sl@0
|
1059 |
{
|
sl@0
|
1060 |
if(source == expectedSource)
|
sl@0
|
1061 |
{
|
sl@0
|
1062 |
INFO_PRINTF3(_L("GetCurrentSource() %S == %S ExpectedResult"), &source, &expectedSource);
|
sl@0
|
1063 |
}
|
sl@0
|
1064 |
else
|
sl@0
|
1065 |
{
|
sl@0
|
1066 |
ERR_PRINTF3(_L("GetCurrentSource() %S != %S ExpectedResult"), &source, &expectedSource);
|
sl@0
|
1067 |
SetBlockResult(EFail);
|
sl@0
|
1068 |
}
|
sl@0
|
1069 |
|
sl@0
|
1070 |
}
|
sl@0
|
1071 |
else
|
sl@0
|
1072 |
{
|
sl@0
|
1073 |
INFO_PRINTF2(_L("GetCurrentSource() %S"), &source);
|
sl@0
|
1074 |
}
|
sl@0
|
1075 |
}
|
sl@0
|
1076 |
|
sl@0
|
1077 |
}
|
sl@0
|
1078 |
void CT_FileManData::DoCmdBytesTransferredByCopyStep(const TDesC& aSection)
|
sl@0
|
1079 |
{
|
sl@0
|
1080 |
TBool readHistory = EFalse;
|
sl@0
|
1081 |
GET_OPTIONAL_BOOL_PARAMETER(KReadHistory, aSection, readHistory);
|
sl@0
|
1082 |
TInt bytes = 0;
|
sl@0
|
1083 |
TBool found = ETrue;
|
sl@0
|
1084 |
if(readHistory)
|
sl@0
|
1085 |
{
|
sl@0
|
1086 |
/** Get needed history array **/
|
sl@0
|
1087 |
RPointerArray<THistoryData>* history = GetHistoryDataByType(aSection);
|
sl@0
|
1088 |
if(history)
|
sl@0
|
1089 |
{
|
sl@0
|
1090 |
TInt expectedBytes;
|
sl@0
|
1091 |
found = EFalse;
|
sl@0
|
1092 |
if(GET_MANDATORY_INT_PARAMETER(KBytes, aSection, expectedBytes))
|
sl@0
|
1093 |
{
|
sl@0
|
1094 |
TBool totalBytes = EFalse;
|
sl@0
|
1095 |
GET_OPTIONAL_BOOL_PARAMETER(KTotalBytes, aSection, totalBytes);
|
sl@0
|
1096 |
TInt count = history->Count();
|
sl@0
|
1097 |
TInt bytesTemp;
|
sl@0
|
1098 |
/** Search for expected transferred bytes in history **/
|
sl@0
|
1099 |
for(TInt i = 0; (!found) && (i < count); i++)
|
sl@0
|
1100 |
{
|
sl@0
|
1101 |
bytesTemp = ((*history)[i])->iBytesTransferred;
|
sl@0
|
1102 |
if(totalBytes)
|
sl@0
|
1103 |
{
|
sl@0
|
1104 |
bytes +=bytesTemp;
|
sl@0
|
1105 |
}
|
sl@0
|
1106 |
else
|
sl@0
|
1107 |
{
|
sl@0
|
1108 |
if( bytesTemp == expectedBytes)
|
sl@0
|
1109 |
{
|
sl@0
|
1110 |
bytes = bytesTemp;
|
sl@0
|
1111 |
found = ETrue;
|
sl@0
|
1112 |
}
|
sl@0
|
1113 |
}
|
sl@0
|
1114 |
}
|
sl@0
|
1115 |
if(totalBytes)
|
sl@0
|
1116 |
{
|
sl@0
|
1117 |
found = ETrue;
|
sl@0
|
1118 |
}
|
sl@0
|
1119 |
if(!found)
|
sl@0
|
1120 |
{
|
sl@0
|
1121 |
ERR_PRINTF2(_L("BytesTransferredByCopyStep() %d not found in history!"), expectedBytes);
|
sl@0
|
1122 |
SetBlockResult(EFail);
|
sl@0
|
1123 |
}
|
sl@0
|
1124 |
}
|
sl@0
|
1125 |
}
|
sl@0
|
1126 |
}
|
sl@0
|
1127 |
else
|
sl@0
|
1128 |
{
|
sl@0
|
1129 |
bytes = iFileMan->BytesTransferredByCopyStep();
|
sl@0
|
1130 |
}
|
sl@0
|
1131 |
if (found)
|
sl@0
|
1132 |
{
|
sl@0
|
1133 |
TInt expectedBytes;
|
sl@0
|
1134 |
if(GET_OPTIONAL_INT_PARAMETER(KBytes, aSection, expectedBytes))
|
sl@0
|
1135 |
{
|
sl@0
|
1136 |
if(expectedBytes != bytes)
|
sl@0
|
1137 |
{
|
sl@0
|
1138 |
ERR_PRINTF3(_L("BytesTransferredByCopyStep(): %d != %d Expected Bytes"), bytes, expectedBytes);
|
sl@0
|
1139 |
SetBlockResult(EFail);
|
sl@0
|
1140 |
}
|
sl@0
|
1141 |
else
|
sl@0
|
1142 |
{
|
sl@0
|
1143 |
INFO_PRINTF3(_L("BytesTransferredByCopyStep(): %d == %d Expected Bytes"), bytes, expectedBytes);
|
sl@0
|
1144 |
}
|
sl@0
|
1145 |
}
|
sl@0
|
1146 |
else
|
sl@0
|
1147 |
{
|
sl@0
|
1148 |
INFO_PRINTF2(_L("BytesTransferredByCopyStep(): %d"), bytes);
|
sl@0
|
1149 |
}
|
sl@0
|
1150 |
}
|
sl@0
|
1151 |
}
|
sl@0
|
1152 |
void CT_FileManData::DoCmdCurrentEntryL(const TDesC& aSection)
|
sl@0
|
1153 |
{
|
sl@0
|
1154 |
|
sl@0
|
1155 |
TEntry* entryObject = NULL;
|
sl@0
|
1156 |
TBool found = ETrue;
|
sl@0
|
1157 |
TBool readHistory = EFalse;
|
sl@0
|
1158 |
GET_OPTIONAL_BOOL_PARAMETER(KReadHistory, aSection, readHistory);
|
sl@0
|
1159 |
if(readHistory)
|
sl@0
|
1160 |
{
|
sl@0
|
1161 |
/** Get needed history array **/
|
sl@0
|
1162 |
RPointerArray<THistoryData>* history = GetHistoryDataByType(aSection);
|
sl@0
|
1163 |
if(history)
|
sl@0
|
1164 |
{
|
sl@0
|
1165 |
TPtrC expectedName;
|
sl@0
|
1166 |
found = EFalse;
|
sl@0
|
1167 |
if(GET_MANDATORY_STRING_PARAMETER(KName, aSection, expectedName))
|
sl@0
|
1168 |
{
|
sl@0
|
1169 |
TInt count = history->Count();
|
sl@0
|
1170 |
TEntry entry;
|
sl@0
|
1171 |
/** Search for expected TEntry.iName in history **/
|
sl@0
|
1172 |
for(TInt i = 0; (!found) && (i < count); i++)
|
sl@0
|
1173 |
{
|
sl@0
|
1174 |
entry = ((*history)[i])->iCurrentEntry;
|
sl@0
|
1175 |
if( entry.iName == expectedName)
|
sl@0
|
1176 |
{
|
sl@0
|
1177 |
entryObject = &entry;
|
sl@0
|
1178 |
found = ETrue;
|
sl@0
|
1179 |
}
|
sl@0
|
1180 |
}
|
sl@0
|
1181 |
if(!found)
|
sl@0
|
1182 |
{
|
sl@0
|
1183 |
ERR_PRINTF1(_L("CurrentEntry() not found in history!"));
|
sl@0
|
1184 |
SetBlockResult(EFail);
|
sl@0
|
1185 |
}
|
sl@0
|
1186 |
}
|
sl@0
|
1187 |
}
|
sl@0
|
1188 |
}
|
sl@0
|
1189 |
else
|
sl@0
|
1190 |
{
|
sl@0
|
1191 |
*entryObject = iFileMan->CurrentEntry();
|
sl@0
|
1192 |
}
|
sl@0
|
1193 |
if(found)
|
sl@0
|
1194 |
{
|
sl@0
|
1195 |
if(!FileserverUtil::VerifyTEntryDataFromIniL(*this, aSection, *entryObject))
|
sl@0
|
1196 |
{
|
sl@0
|
1197 |
SetBlockResult(EFail);
|
sl@0
|
1198 |
}
|
sl@0
|
1199 |
}
|
sl@0
|
1200 |
|
sl@0
|
1201 |
}
|
sl@0
|
1202 |
void CT_FileManData::DoCmdAbbreviatedPath(const TDesC& aSection)
|
sl@0
|
1203 |
{
|
sl@0
|
1204 |
TBool readHistory = EFalse;
|
sl@0
|
1205 |
GET_OPTIONAL_BOOL_PARAMETER(KReadHistory, aSection, readHistory);
|
sl@0
|
1206 |
TPtrC path;
|
sl@0
|
1207 |
TBool found = ETrue;
|
sl@0
|
1208 |
if(readHistory)
|
sl@0
|
1209 |
{
|
sl@0
|
1210 |
/** Get needed history array **/
|
sl@0
|
1211 |
RPointerArray<THistoryData>* history = GetHistoryDataByType(aSection);
|
sl@0
|
1212 |
if(history)
|
sl@0
|
1213 |
{
|
sl@0
|
1214 |
TPtrC expectedPath;
|
sl@0
|
1215 |
found = EFalse;
|
sl@0
|
1216 |
if(GET_MANDATORY_STRING_PARAMETER(KPath, aSection, expectedPath))
|
sl@0
|
1217 |
{
|
sl@0
|
1218 |
TInt count = history->Count();
|
sl@0
|
1219 |
/** Search for expected abbreviated path in history **/
|
sl@0
|
1220 |
for(TInt i = 0; (!found) && (i < count); i++)
|
sl@0
|
1221 |
{
|
sl@0
|
1222 |
if( ((*history)[i])->iAbbreviatedPath == expectedPath)
|
sl@0
|
1223 |
{
|
sl@0
|
1224 |
path.Set(((*history)[i])->iAbbreviatedPath);
|
sl@0
|
1225 |
found = ETrue;
|
sl@0
|
1226 |
}
|
sl@0
|
1227 |
}
|
sl@0
|
1228 |
if(!found)
|
sl@0
|
1229 |
{
|
sl@0
|
1230 |
ERR_PRINTF2(_L("AbbreviatedPath() %S not found in history!"), &expectedPath);
|
sl@0
|
1231 |
SetBlockResult(EFail);
|
sl@0
|
1232 |
}
|
sl@0
|
1233 |
}
|
sl@0
|
1234 |
}
|
sl@0
|
1235 |
}
|
sl@0
|
1236 |
else
|
sl@0
|
1237 |
{
|
sl@0
|
1238 |
path.Set(iFileMan->AbbreviatedPath());
|
sl@0
|
1239 |
}
|
sl@0
|
1240 |
|
sl@0
|
1241 |
if (found)
|
sl@0
|
1242 |
{
|
sl@0
|
1243 |
TPtrC expectedPath;
|
sl@0
|
1244 |
if(GET_OPTIONAL_STRING_PARAMETER(KPath, aSection, expectedPath))
|
sl@0
|
1245 |
{
|
sl@0
|
1246 |
if(expectedPath.Compare(path) != 0)
|
sl@0
|
1247 |
{
|
sl@0
|
1248 |
ERR_PRINTF3(_L("AbbreviatedPath(): %S != %S Expected Path"), &path, &expectedPath);
|
sl@0
|
1249 |
SetBlockResult(EFail);
|
sl@0
|
1250 |
}
|
sl@0
|
1251 |
else
|
sl@0
|
1252 |
{
|
sl@0
|
1253 |
INFO_PRINTF3(_L("AbbreviatedPath(): %S == %S Expected Path"), &path, &expectedPath);
|
sl@0
|
1254 |
}
|
sl@0
|
1255 |
}
|
sl@0
|
1256 |
else
|
sl@0
|
1257 |
{
|
sl@0
|
1258 |
INFO_PRINTF2(_L("AbbreviatedPath(): %S"), &path);
|
sl@0
|
1259 |
}
|
sl@0
|
1260 |
}
|
sl@0
|
1261 |
}
|
sl@0
|
1262 |
void CT_FileManData::DoCmdFullPath(const TDesC& aSection)
|
sl@0
|
1263 |
{
|
sl@0
|
1264 |
TBool readHistory = EFalse;
|
sl@0
|
1265 |
GET_OPTIONAL_BOOL_PARAMETER(KReadHistory, aSection, readHistory);
|
sl@0
|
1266 |
TPtrC fullPath;
|
sl@0
|
1267 |
TBool found = ETrue;
|
sl@0
|
1268 |
if(readHistory)
|
sl@0
|
1269 |
{
|
sl@0
|
1270 |
/** Get needed history array **/
|
sl@0
|
1271 |
RPointerArray<THistoryData>* history = GetHistoryDataByType(aSection);
|
sl@0
|
1272 |
if(history)
|
sl@0
|
1273 |
{
|
sl@0
|
1274 |
TPtrC expectedPath;
|
sl@0
|
1275 |
found = EFalse;
|
sl@0
|
1276 |
if(GET_MANDATORY_STRING_PARAMETER(KPath, aSection, expectedPath))
|
sl@0
|
1277 |
{
|
sl@0
|
1278 |
TInt count = history->Count();
|
sl@0
|
1279 |
/** Search for expected full path in history **/
|
sl@0
|
1280 |
for(TInt i = 0; (!found) && (i < count); i++)
|
sl@0
|
1281 |
{
|
sl@0
|
1282 |
if( ((*history)[i])->iFullPath == expectedPath)
|
sl@0
|
1283 |
{
|
sl@0
|
1284 |
fullPath.Set(((*history)[i])->iFullPath);
|
sl@0
|
1285 |
found = ETrue;
|
sl@0
|
1286 |
}
|
sl@0
|
1287 |
}
|
sl@0
|
1288 |
if(!found)
|
sl@0
|
1289 |
{
|
sl@0
|
1290 |
ERR_PRINTF2(_L("FullPath() %S not found in history!"), &expectedPath);
|
sl@0
|
1291 |
SetBlockResult(EFail);
|
sl@0
|
1292 |
}
|
sl@0
|
1293 |
}
|
sl@0
|
1294 |
}
|
sl@0
|
1295 |
}
|
sl@0
|
1296 |
else
|
sl@0
|
1297 |
{
|
sl@0
|
1298 |
fullPath.Set(iFileMan->FullPath());
|
sl@0
|
1299 |
}
|
sl@0
|
1300 |
if(found)
|
sl@0
|
1301 |
{
|
sl@0
|
1302 |
TPtrC expectedPath;
|
sl@0
|
1303 |
if(GET_OPTIONAL_STRING_PARAMETER(KPath, aSection, expectedPath))
|
sl@0
|
1304 |
{
|
sl@0
|
1305 |
if(expectedPath.Compare(fullPath) != 0)
|
sl@0
|
1306 |
{
|
sl@0
|
1307 |
ERR_PRINTF3(_L("FullPath(): %S != %S Expected Path"), &fullPath, &expectedPath);
|
sl@0
|
1308 |
SetBlockResult(EFail);
|
sl@0
|
1309 |
}
|
sl@0
|
1310 |
else
|
sl@0
|
1311 |
{
|
sl@0
|
1312 |
INFO_PRINTF3(_L("FullPath(): %S == %S Expected Path"), &fullPath, &expectedPath);
|
sl@0
|
1313 |
}
|
sl@0
|
1314 |
}
|
sl@0
|
1315 |
else
|
sl@0
|
1316 |
{
|
sl@0
|
1317 |
INFO_PRINTF2(_L("FullPath(): %S"), &fullPath);
|
sl@0
|
1318 |
}
|
sl@0
|
1319 |
}
|
sl@0
|
1320 |
}
|
sl@0
|
1321 |
void CT_FileManData::DoCmdGetLastError(const TDesC& aSection)
|
sl@0
|
1322 |
{
|
sl@0
|
1323 |
TBool readHistory = EFalse;
|
sl@0
|
1324 |
GET_OPTIONAL_BOOL_PARAMETER(KReadHistory, aSection, readHistory);
|
sl@0
|
1325 |
TInt lastError = KErrNone;
|
sl@0
|
1326 |
TBool found = ETrue;
|
sl@0
|
1327 |
if(readHistory)
|
sl@0
|
1328 |
{
|
sl@0
|
1329 |
/** Get needed history array **/
|
sl@0
|
1330 |
RPointerArray<THistoryData>* history = GetHistoryDataByType(aSection);
|
sl@0
|
1331 |
if(history)
|
sl@0
|
1332 |
{
|
sl@0
|
1333 |
TInt expectedError;
|
sl@0
|
1334 |
found = EFalse;
|
sl@0
|
1335 |
if(GET_MANDATORY_INT_PARAMETER(KError, aSection, expectedError))
|
sl@0
|
1336 |
{
|
sl@0
|
1337 |
TInt count = history->Count();
|
sl@0
|
1338 |
TInt err;
|
sl@0
|
1339 |
/** Search for expected error in history **/
|
sl@0
|
1340 |
for(TInt i = 0; (!found) && (i < count); i++)
|
sl@0
|
1341 |
{
|
sl@0
|
1342 |
err = (*history)[i]->iLastError;
|
sl@0
|
1343 |
if( err == expectedError)
|
sl@0
|
1344 |
{
|
sl@0
|
1345 |
lastError = err;
|
sl@0
|
1346 |
found = ETrue;
|
sl@0
|
1347 |
}
|
sl@0
|
1348 |
}
|
sl@0
|
1349 |
if(!found)
|
sl@0
|
1350 |
{
|
sl@0
|
1351 |
ERR_PRINTF2(_L("GetLastError() %d not found in history!"), expectedError);
|
sl@0
|
1352 |
SetBlockResult(EFail);
|
sl@0
|
1353 |
}
|
sl@0
|
1354 |
}
|
sl@0
|
1355 |
}
|
sl@0
|
1356 |
}
|
sl@0
|
1357 |
else
|
sl@0
|
1358 |
{
|
sl@0
|
1359 |
lastError = iFileMan->GetLastError();
|
sl@0
|
1360 |
}
|
sl@0
|
1361 |
if (found)
|
sl@0
|
1362 |
{
|
sl@0
|
1363 |
TInt expectedError;
|
sl@0
|
1364 |
if(GET_OPTIONAL_INT_PARAMETER(KError, aSection, expectedError))
|
sl@0
|
1365 |
{
|
sl@0
|
1366 |
if(expectedError != lastError)
|
sl@0
|
1367 |
{
|
sl@0
|
1368 |
ERR_PRINTF3(_L("GetLastError(): %d != %d Expected Error"), lastError, expectedError);
|
sl@0
|
1369 |
SetBlockResult(EFail);
|
sl@0
|
1370 |
}
|
sl@0
|
1371 |
else
|
sl@0
|
1372 |
{
|
sl@0
|
1373 |
INFO_PRINTF3(_L("GetLastError(): %d == %d Expected Error"), lastError, expectedError);
|
sl@0
|
1374 |
}
|
sl@0
|
1375 |
}
|
sl@0
|
1376 |
else
|
sl@0
|
1377 |
{
|
sl@0
|
1378 |
INFO_PRINTF2(_L("GetLastError(): %d"), lastError);
|
sl@0
|
1379 |
}
|
sl@0
|
1380 |
}
|
sl@0
|
1381 |
}
|
sl@0
|
1382 |
|
sl@0
|
1383 |
void CT_FileManData::DoCmdGetMoreInfoAboutError(const TDesC& aSection)
|
sl@0
|
1384 |
{
|
sl@0
|
1385 |
TBool readHistory = EFalse;
|
sl@0
|
1386 |
GET_OPTIONAL_BOOL_PARAMETER(KReadHistory, aSection, readHistory);
|
sl@0
|
1387 |
TFileManError lastError;
|
sl@0
|
1388 |
TBool found = ETrue;
|
sl@0
|
1389 |
if(readHistory)
|
sl@0
|
1390 |
{
|
sl@0
|
1391 |
/** Get needed history array **/
|
sl@0
|
1392 |
RPointerArray<THistoryData>* history = GetHistoryDataByType(aSection);
|
sl@0
|
1393 |
if(history)
|
sl@0
|
1394 |
{
|
sl@0
|
1395 |
TFileManError expectedError;
|
sl@0
|
1396 |
found = EFalse;
|
sl@0
|
1397 |
if(GetFileManErrorFromConfig(KError, aSection, expectedError))
|
sl@0
|
1398 |
{
|
sl@0
|
1399 |
TInt count = history->Count();
|
sl@0
|
1400 |
TFileManError error;
|
sl@0
|
1401 |
/** Search for expected error in history **/
|
sl@0
|
1402 |
for(TInt i = 0; (!found) && (i < count); i++)
|
sl@0
|
1403 |
{
|
sl@0
|
1404 |
error = (*history)[i]->iMoreInfoAboutError;
|
sl@0
|
1405 |
if( (error == expectedError))
|
sl@0
|
1406 |
{
|
sl@0
|
1407 |
lastError = error;
|
sl@0
|
1408 |
found = ETrue;
|
sl@0
|
1409 |
}
|
sl@0
|
1410 |
}
|
sl@0
|
1411 |
if(!found)
|
sl@0
|
1412 |
{
|
sl@0
|
1413 |
ERR_PRINTF2(_L("GetMoreInfoAboutError() %S not found in history!"), expectedError);
|
sl@0
|
1414 |
SetBlockResult(EFail);
|
sl@0
|
1415 |
}
|
sl@0
|
1416 |
}
|
sl@0
|
1417 |
}
|
sl@0
|
1418 |
}
|
sl@0
|
1419 |
else
|
sl@0
|
1420 |
{
|
sl@0
|
1421 |
lastError = iFileMan->GetMoreInfoAboutError();
|
sl@0
|
1422 |
}
|
sl@0
|
1423 |
if (found)
|
sl@0
|
1424 |
{
|
sl@0
|
1425 |
TPtrC errorStr;
|
sl@0
|
1426 |
ConvertFileManErrorToString(lastError, errorStr);
|
sl@0
|
1427 |
TFileManError expectedError;
|
sl@0
|
1428 |
if(GetFileManErrorFromConfig(KError, aSection, expectedError))
|
sl@0
|
1429 |
{
|
sl@0
|
1430 |
TPtrC expectedErrorStr;
|
sl@0
|
1431 |
ConvertFileManErrorToString(expectedError, expectedErrorStr);
|
sl@0
|
1432 |
|
sl@0
|
1433 |
if(expectedError != lastError)
|
sl@0
|
1434 |
{
|
sl@0
|
1435 |
ERR_PRINTF3(_L("GetMoreInfoAboutError(): %S != %S Expected Error"), &errorStr, &expectedErrorStr);
|
sl@0
|
1436 |
SetBlockResult(EFail);
|
sl@0
|
1437 |
}
|
sl@0
|
1438 |
else
|
sl@0
|
1439 |
{
|
sl@0
|
1440 |
INFO_PRINTF3(_L("GetMoreInfoAboutError(): %S == %S Expected Error"), &errorStr, &expectedErrorStr);
|
sl@0
|
1441 |
}
|
sl@0
|
1442 |
}
|
sl@0
|
1443 |
else
|
sl@0
|
1444 |
{
|
sl@0
|
1445 |
INFO_PRINTF2(_L("GetMoreInfoAboutError(): %S"), &errorStr);
|
sl@0
|
1446 |
}
|
sl@0
|
1447 |
}
|
sl@0
|
1448 |
|
sl@0
|
1449 |
}
|
sl@0
|
1450 |
void CT_FileManData::RunL(CActive* aActive, TInt aIndex)
|
sl@0
|
1451 |
/**
|
sl@0
|
1452 |
Virtual RunL - Called on completion of an asynchronous command
|
sl@0
|
1453 |
@internalComponent
|
sl@0
|
1454 |
@see MActiveCallback
|
sl@0
|
1455 |
@param aActive Active Object that RunL has been called on
|
sl@0
|
1456 |
@pre N/A
|
sl@0
|
1457 |
@post N/A
|
sl@0
|
1458 |
@leave system wide error code
|
sl@0
|
1459 |
*/
|
sl@0
|
1460 |
{
|
sl@0
|
1461 |
INFO_PRINTF1(_L("CT_FileManData::RunL Called"));
|
sl@0
|
1462 |
TBool foundActiveObject = EFalse;
|
sl@0
|
1463 |
TInt index=0;
|
sl@0
|
1464 |
TInt count=0;
|
sl@0
|
1465 |
TBool completed=ETrue;
|
sl@0
|
1466 |
|
sl@0
|
1467 |
count = iAttribs.Count();
|
sl@0
|
1468 |
for( index=0; (index<count) && (!foundActiveObject); ++index )
|
sl@0
|
1469 |
{
|
sl@0
|
1470 |
if( aActive == iAttribs[index] )
|
sl@0
|
1471 |
{
|
sl@0
|
1472 |
INFO_PRINTF1(_L("RunL iAttribs called"));
|
sl@0
|
1473 |
foundActiveObject = ETrue;
|
sl@0
|
1474 |
iAttribs.Remove(index);
|
sl@0
|
1475 |
}
|
sl@0
|
1476 |
}
|
sl@0
|
1477 |
|
sl@0
|
1478 |
count = iCopy.Count();
|
sl@0
|
1479 |
for( index=0; (index<count) && (!foundActiveObject); ++index )
|
sl@0
|
1480 |
{
|
sl@0
|
1481 |
if( aActive == iCopy[index] )
|
sl@0
|
1482 |
{
|
sl@0
|
1483 |
INFO_PRINTF1(_L("RunL iCopy called"));
|
sl@0
|
1484 |
foundActiveObject = ETrue;
|
sl@0
|
1485 |
iCopy.Remove(index);
|
sl@0
|
1486 |
}
|
sl@0
|
1487 |
}
|
sl@0
|
1488 |
|
sl@0
|
1489 |
count = iDelete.Count();
|
sl@0
|
1490 |
for( index=0; (index<count) && (!foundActiveObject); ++index )
|
sl@0
|
1491 |
{
|
sl@0
|
1492 |
if( aActive == iDelete[index] )
|
sl@0
|
1493 |
{
|
sl@0
|
1494 |
INFO_PRINTF1(_L("RunL iDelete called"));
|
sl@0
|
1495 |
foundActiveObject = ETrue;
|
sl@0
|
1496 |
iDelete.Remove(index);
|
sl@0
|
1497 |
}
|
sl@0
|
1498 |
}
|
sl@0
|
1499 |
|
sl@0
|
1500 |
count = iMove.Count();
|
sl@0
|
1501 |
for( index=0; (index<count) && (!foundActiveObject); ++index )
|
sl@0
|
1502 |
{
|
sl@0
|
1503 |
if( aActive == iMove[index] )
|
sl@0
|
1504 |
{
|
sl@0
|
1505 |
INFO_PRINTF1(_L("RunL iMove called"));
|
sl@0
|
1506 |
foundActiveObject = ETrue;
|
sl@0
|
1507 |
iMove.Remove(index);
|
sl@0
|
1508 |
}
|
sl@0
|
1509 |
}
|
sl@0
|
1510 |
|
sl@0
|
1511 |
count = iRename.Count();
|
sl@0
|
1512 |
for( index=0; (index<count) && (!foundActiveObject); ++index )
|
sl@0
|
1513 |
{
|
sl@0
|
1514 |
if( aActive == iRename[index] )
|
sl@0
|
1515 |
{
|
sl@0
|
1516 |
INFO_PRINTF1(_L("RunL iRename called"));
|
sl@0
|
1517 |
foundActiveObject = ETrue;
|
sl@0
|
1518 |
iRename.Remove(index);
|
sl@0
|
1519 |
}
|
sl@0
|
1520 |
}
|
sl@0
|
1521 |
|
sl@0
|
1522 |
count = iRmDir.Count();
|
sl@0
|
1523 |
for( index=0; (index<count) && (!foundActiveObject); ++index )
|
sl@0
|
1524 |
{
|
sl@0
|
1525 |
if( aActive == iRmDir[index] )
|
sl@0
|
1526 |
{
|
sl@0
|
1527 |
INFO_PRINTF1(_L("RunL iRmDir called"));
|
sl@0
|
1528 |
foundActiveObject = ETrue;
|
sl@0
|
1529 |
iRmDir.Remove(index);
|
sl@0
|
1530 |
}
|
sl@0
|
1531 |
}
|
sl@0
|
1532 |
|
sl@0
|
1533 |
if( foundActiveObject )
|
sl@0
|
1534 |
{
|
sl@0
|
1535 |
TInt err = aActive->iStatus.Int();
|
sl@0
|
1536 |
if( err != KErrNone )
|
sl@0
|
1537 |
{
|
sl@0
|
1538 |
ERR_PRINTF2(_L("RunL Error %d"), err);
|
sl@0
|
1539 |
SetAsyncError( aIndex, err );
|
sl@0
|
1540 |
iAsyncCall = EFalse;
|
sl@0
|
1541 |
}
|
sl@0
|
1542 |
|
sl@0
|
1543 |
if ( completed )
|
sl@0
|
1544 |
{
|
sl@0
|
1545 |
// Reset the outstanding request state
|
sl@0
|
1546 |
DecOutstanding();
|
sl@0
|
1547 |
delete aActive;
|
sl@0
|
1548 |
}
|
sl@0
|
1549 |
}
|
sl@0
|
1550 |
else
|
sl@0
|
1551 |
{
|
sl@0
|
1552 |
ERR_PRINTF1(_L("Stray RunL signal"));
|
sl@0
|
1553 |
SetBlockResult(EFail);
|
sl@0
|
1554 |
}
|
sl@0
|
1555 |
}
|
sl@0
|
1556 |
|
sl@0
|
1557 |
|
sl@0
|
1558 |
void CT_FileManData::DoCancel(CActive* aActive, TInt aIndex)
|
sl@0
|
1559 |
/**
|
sl@0
|
1560 |
Virtual DoCancel - Request to cancel the asynchronous command
|
sl@0
|
1561 |
@internalComponent
|
sl@0
|
1562 |
@see - MActiveCallback
|
sl@0
|
1563 |
@param aActive Active Object that DoCancel has been called on
|
sl@0
|
1564 |
@pre - N/A
|
sl@0
|
1565 |
@post - N/A
|
sl@0
|
1566 |
@leave system wide error code
|
sl@0
|
1567 |
*/
|
sl@0
|
1568 |
{
|
sl@0
|
1569 |
INFO_PRINTF1(_L("CT_FileManData::DoCancelL Called"));
|
sl@0
|
1570 |
|
sl@0
|
1571 |
TBool foundActiveObject = EFalse;
|
sl@0
|
1572 |
TInt index=0;
|
sl@0
|
1573 |
TInt count=0;
|
sl@0
|
1574 |
|
sl@0
|
1575 |
|
sl@0
|
1576 |
// See if it is in iAttribs
|
sl@0
|
1577 |
count = iAttribs.Count();
|
sl@0
|
1578 |
for( index=0; (index<count) && (!foundActiveObject); ++index )
|
sl@0
|
1579 |
{
|
sl@0
|
1580 |
if( aActive == iAttribs[index] )
|
sl@0
|
1581 |
{
|
sl@0
|
1582 |
INFO_PRINTF1(_L("DoCancel iAttribs called"));
|
sl@0
|
1583 |
foundActiveObject = ETrue;
|
sl@0
|
1584 |
iAttribs.Remove(index);
|
sl@0
|
1585 |
}
|
sl@0
|
1586 |
}
|
sl@0
|
1587 |
|
sl@0
|
1588 |
// See if it is in iCopy2
|
sl@0
|
1589 |
count = iCopy.Count();
|
sl@0
|
1590 |
for( index=0; (index<count) && (!foundActiveObject); ++index )
|
sl@0
|
1591 |
{
|
sl@0
|
1592 |
if( aActive == iCopy[index] )
|
sl@0
|
1593 |
{
|
sl@0
|
1594 |
INFO_PRINTF1(_L("DoCancel iCopy called"));
|
sl@0
|
1595 |
foundActiveObject = ETrue;
|
sl@0
|
1596 |
iCopy.Remove(index);
|
sl@0
|
1597 |
}
|
sl@0
|
1598 |
}
|
sl@0
|
1599 |
|
sl@0
|
1600 |
// See if it is in iDelete
|
sl@0
|
1601 |
count = iDelete.Count();
|
sl@0
|
1602 |
for( index=0; (index<count) && (!foundActiveObject); ++index )
|
sl@0
|
1603 |
{
|
sl@0
|
1604 |
if( aActive == iDelete[index] )
|
sl@0
|
1605 |
{
|
sl@0
|
1606 |
INFO_PRINTF1(_L("DoCancel iDelete called"));
|
sl@0
|
1607 |
foundActiveObject = ETrue;
|
sl@0
|
1608 |
iDelete.Remove(index);
|
sl@0
|
1609 |
}
|
sl@0
|
1610 |
}
|
sl@0
|
1611 |
|
sl@0
|
1612 |
// See if it is in iMove
|
sl@0
|
1613 |
count = iMove.Count();
|
sl@0
|
1614 |
for( index=0; (index<count) && (!foundActiveObject); ++index )
|
sl@0
|
1615 |
{
|
sl@0
|
1616 |
if( aActive == iMove[index] )
|
sl@0
|
1617 |
{
|
sl@0
|
1618 |
INFO_PRINTF1(_L("DoCancel iMove called"));
|
sl@0
|
1619 |
foundActiveObject = ETrue;
|
sl@0
|
1620 |
iMove.Remove(index);
|
sl@0
|
1621 |
}
|
sl@0
|
1622 |
}
|
sl@0
|
1623 |
|
sl@0
|
1624 |
// See if it is in iRename
|
sl@0
|
1625 |
count = iRename.Count();
|
sl@0
|
1626 |
for( index=0; (index<count) && (!foundActiveObject); ++index )
|
sl@0
|
1627 |
{
|
sl@0
|
1628 |
if( aActive == iRename[index] )
|
sl@0
|
1629 |
{
|
sl@0
|
1630 |
INFO_PRINTF1(_L("DoCancel iRename called"));
|
sl@0
|
1631 |
foundActiveObject = ETrue;
|
sl@0
|
1632 |
iRename.Remove(index);
|
sl@0
|
1633 |
}
|
sl@0
|
1634 |
}
|
sl@0
|
1635 |
|
sl@0
|
1636 |
// See if it is in iRmDir
|
sl@0
|
1637 |
count = iRmDir.Count();
|
sl@0
|
1638 |
for( index=0; (index<count) && (!foundActiveObject); ++index )
|
sl@0
|
1639 |
{
|
sl@0
|
1640 |
if( aActive == iRmDir[index] )
|
sl@0
|
1641 |
{
|
sl@0
|
1642 |
INFO_PRINTF1(_L("DoCancel iRmDir called"));
|
sl@0
|
1643 |
foundActiveObject = ETrue;
|
sl@0
|
1644 |
iRmDir.Remove(index);
|
sl@0
|
1645 |
}
|
sl@0
|
1646 |
}
|
sl@0
|
1647 |
|
sl@0
|
1648 |
if( foundActiveObject )
|
sl@0
|
1649 |
{
|
sl@0
|
1650 |
TInt err = aActive->iStatus.Int();
|
sl@0
|
1651 |
if( err != KErrNone )
|
sl@0
|
1652 |
{
|
sl@0
|
1653 |
ERR_PRINTF2(_L("DoCancel Error %d"), err);
|
sl@0
|
1654 |
SetAsyncError( aIndex, err );
|
sl@0
|
1655 |
}
|
sl@0
|
1656 |
|
sl@0
|
1657 |
// Reset the outstanding request state
|
sl@0
|
1658 |
DecOutstanding();
|
sl@0
|
1659 |
|
sl@0
|
1660 |
delete aActive;
|
sl@0
|
1661 |
}
|
sl@0
|
1662 |
else
|
sl@0
|
1663 |
{
|
sl@0
|
1664 |
ERR_PRINTF1(_L("Stray DoCancel signal"));
|
sl@0
|
1665 |
SetBlockResult(EFail);
|
sl@0
|
1666 |
}
|
sl@0
|
1667 |
}
|
sl@0
|
1668 |
|
sl@0
|
1669 |
/** Reads TFileManError from INI and converts it to TFileManError type. **/
|
sl@0
|
1670 |
TBool CT_FileManData::GetFileManErrorFromConfig(const TDesC& aParameterName, const TDesC& aSection, TFileManError& aError)
|
sl@0
|
1671 |
{
|
sl@0
|
1672 |
TPtrC errorStr;
|
sl@0
|
1673 |
TBool ret = GET_OPTIONAL_STRING_PARAMETER(aParameterName, aSection, errorStr);
|
sl@0
|
1674 |
if(ret)
|
sl@0
|
1675 |
{
|
sl@0
|
1676 |
if(errorStr == KENoExtraInformation)
|
sl@0
|
1677 |
{
|
sl@0
|
1678 |
aError = ENoExtraInformation;
|
sl@0
|
1679 |
}
|
sl@0
|
1680 |
else if(errorStr == KEInitializationFailed)
|
sl@0
|
1681 |
{
|
sl@0
|
1682 |
aError = EInitializationFailed;
|
sl@0
|
1683 |
}
|
sl@0
|
1684 |
else if (errorStr == KEScanNextDirectoryFailed)
|
sl@0
|
1685 |
{
|
sl@0
|
1686 |
aError = EScanNextDirectoryFailed;
|
sl@0
|
1687 |
}
|
sl@0
|
1688 |
else if (errorStr == KESrcOpenFailed)
|
sl@0
|
1689 |
{
|
sl@0
|
1690 |
aError = ESrcOpenFailed;
|
sl@0
|
1691 |
}
|
sl@0
|
1692 |
else if (errorStr == KETrgOpenFailed)
|
sl@0
|
1693 |
{
|
sl@0
|
1694 |
aError = ETrgOpenFailed;
|
sl@0
|
1695 |
}
|
sl@0
|
1696 |
else if (errorStr == KENoFilesProcessed)
|
sl@0
|
1697 |
{
|
sl@0
|
1698 |
aError = ENoFilesProcessed;
|
sl@0
|
1699 |
}
|
sl@0
|
1700 |
else
|
sl@0
|
1701 |
{
|
sl@0
|
1702 |
ret = EFalse;
|
sl@0
|
1703 |
}
|
sl@0
|
1704 |
}
|
sl@0
|
1705 |
return ret;
|
sl@0
|
1706 |
}
|
sl@0
|
1707 |
|
sl@0
|
1708 |
/** Converts TFileManError type to string **/
|
sl@0
|
1709 |
void CT_FileManData::ConvertFileManErrorToString(TFileManError& aError, TPtrC& aErrorStr)
|
sl@0
|
1710 |
{
|
sl@0
|
1711 |
if(aError == ENoExtraInformation)
|
sl@0
|
1712 |
{
|
sl@0
|
1713 |
aErrorStr.Set(KENoExtraInformation());
|
sl@0
|
1714 |
}
|
sl@0
|
1715 |
else if(aError == EInitializationFailed)
|
sl@0
|
1716 |
{
|
sl@0
|
1717 |
aErrorStr.Set(KEInitializationFailed());
|
sl@0
|
1718 |
}
|
sl@0
|
1719 |
else if (aError == EScanNextDirectoryFailed)
|
sl@0
|
1720 |
{
|
sl@0
|
1721 |
aErrorStr.Set(KEScanNextDirectoryFailed());
|
sl@0
|
1722 |
}
|
sl@0
|
1723 |
else if (aError == ESrcOpenFailed)
|
sl@0
|
1724 |
{
|
sl@0
|
1725 |
aErrorStr.Set(KESrcOpenFailed());
|
sl@0
|
1726 |
}
|
sl@0
|
1727 |
else if (aError == ETrgOpenFailed)
|
sl@0
|
1728 |
{
|
sl@0
|
1729 |
aErrorStr.Set(KETrgOpenFailed());
|
sl@0
|
1730 |
}
|
sl@0
|
1731 |
else if (aError == ENoFilesProcessed)
|
sl@0
|
1732 |
{
|
sl@0
|
1733 |
aErrorStr.Set(KENoFilesProcessed());
|
sl@0
|
1734 |
}
|
sl@0
|
1735 |
}
|
sl@0
|
1736 |
|
sl@0
|
1737 |
/** Converts CFileMan::TAction type to string **/
|
sl@0
|
1738 |
void CT_FileManData::ConvertActionToString(CFileMan::TAction aAction, TPtrC& aActionStr)
|
sl@0
|
1739 |
{
|
sl@0
|
1740 |
if (aAction == CFileMan::EAttribs)
|
sl@0
|
1741 |
{
|
sl@0
|
1742 |
aActionStr.Set(KEAttribs());
|
sl@0
|
1743 |
}
|
sl@0
|
1744 |
else if (aAction == CFileMan::ECopy)
|
sl@0
|
1745 |
{
|
sl@0
|
1746 |
aActionStr.Set(KECopy());
|
sl@0
|
1747 |
}
|
sl@0
|
1748 |
else if (aAction == CFileMan::EDelete)
|
sl@0
|
1749 |
{
|
sl@0
|
1750 |
aActionStr.Set(KEDelete());
|
sl@0
|
1751 |
}
|
sl@0
|
1752 |
else if (aAction == CFileMan::EMove)
|
sl@0
|
1753 |
{
|
sl@0
|
1754 |
aActionStr.Set(KEMove());
|
sl@0
|
1755 |
}
|
sl@0
|
1756 |
else if (aAction == CFileMan::ERename)
|
sl@0
|
1757 |
{
|
sl@0
|
1758 |
aActionStr.Set(KERename());
|
sl@0
|
1759 |
}
|
sl@0
|
1760 |
else if (aAction == CFileMan::ERmDir)
|
sl@0
|
1761 |
{
|
sl@0
|
1762 |
aActionStr.Set(KERmDir());
|
sl@0
|
1763 |
}
|
sl@0
|
1764 |
else if (aAction == CFileMan::ERenameInvalidEntry)
|
sl@0
|
1765 |
{
|
sl@0
|
1766 |
aActionStr.Set(KERenameInvalidEntry());
|
sl@0
|
1767 |
}
|
sl@0
|
1768 |
else if (aAction == CFileMan::ECopyFromHandle)
|
sl@0
|
1769 |
{
|
sl@0
|
1770 |
aActionStr.Set(KECopyFromHandle());
|
sl@0
|
1771 |
}
|
sl@0
|
1772 |
else
|
sl@0
|
1773 |
{
|
sl@0
|
1774 |
aActionStr.Set(KENone());
|
sl@0
|
1775 |
}
|
sl@0
|
1776 |
|
sl@0
|
1777 |
}
|
sl@0
|
1778 |
|
sl@0
|
1779 |
/** Reads CFileMan::TAction from INI and converts it to CFileMan::TAction type. **/
|
sl@0
|
1780 |
TBool CT_FileManData::GetActionFromConfig(const TDesC& aParameterName, const TDesC& aSection, CFileMan::TAction& aAction)
|
sl@0
|
1781 |
{
|
sl@0
|
1782 |
TPtrC actionStr;
|
sl@0
|
1783 |
TBool ret = GET_OPTIONAL_STRING_PARAMETER(aParameterName, aSection, actionStr);
|
sl@0
|
1784 |
if(ret)
|
sl@0
|
1785 |
{
|
sl@0
|
1786 |
if (actionStr == KEAttribs)
|
sl@0
|
1787 |
{
|
sl@0
|
1788 |
aAction = CFileMan::EAttribs;
|
sl@0
|
1789 |
}
|
sl@0
|
1790 |
else if (actionStr == KECopy)
|
sl@0
|
1791 |
{
|
sl@0
|
1792 |
aAction = CFileMan::ECopy;
|
sl@0
|
1793 |
}
|
sl@0
|
1794 |
else if (actionStr == KEDelete)
|
sl@0
|
1795 |
{
|
sl@0
|
1796 |
aAction = CFileMan::EDelete;
|
sl@0
|
1797 |
}
|
sl@0
|
1798 |
else if (actionStr == KEMove)
|
sl@0
|
1799 |
{
|
sl@0
|
1800 |
aAction = CFileMan::EMove;
|
sl@0
|
1801 |
}
|
sl@0
|
1802 |
else if (actionStr == KERename)
|
sl@0
|
1803 |
{
|
sl@0
|
1804 |
aAction = CFileMan::ERename;
|
sl@0
|
1805 |
}
|
sl@0
|
1806 |
else if (actionStr == KERmDir)
|
sl@0
|
1807 |
{
|
sl@0
|
1808 |
aAction = CFileMan::ERmDir;
|
sl@0
|
1809 |
}
|
sl@0
|
1810 |
else if (actionStr == KERenameInvalidEntry)
|
sl@0
|
1811 |
{
|
sl@0
|
1812 |
aAction = CFileMan::ERenameInvalidEntry;
|
sl@0
|
1813 |
}
|
sl@0
|
1814 |
else if (actionStr == KECopyFromHandle)
|
sl@0
|
1815 |
{
|
sl@0
|
1816 |
aAction = CFileMan::ECopyFromHandle;
|
sl@0
|
1817 |
}
|
sl@0
|
1818 |
else if (actionStr == KENone)
|
sl@0
|
1819 |
{
|
sl@0
|
1820 |
aAction = CFileMan::ENone;
|
sl@0
|
1821 |
}
|
sl@0
|
1822 |
else
|
sl@0
|
1823 |
{
|
sl@0
|
1824 |
ret = EFalse;
|
sl@0
|
1825 |
}
|
sl@0
|
1826 |
}
|
sl@0
|
1827 |
return ret;
|
sl@0
|
1828 |
}
|
sl@0
|
1829 |
|
sl@0
|
1830 |
/** Reads CFileMan::TSwitch from INI and converts it to CFileMan::TSwitch type. **/
|
sl@0
|
1831 |
TBool CT_FileManData::GetOperationFromConfig(const TDesC& aParameterName, const TDesC& aSection, TUint& aSwitch)
|
sl@0
|
1832 |
{
|
sl@0
|
1833 |
TPtrC operation;
|
sl@0
|
1834 |
TBool ret=GET_MANDATORY_STRING_PARAMETER(aParameterName, aSection, operation);
|
sl@0
|
1835 |
if(ret)
|
sl@0
|
1836 |
{
|
sl@0
|
1837 |
if (operation == KEOverWrite)
|
sl@0
|
1838 |
{
|
sl@0
|
1839 |
aSwitch = CFileMan::EOverWrite;
|
sl@0
|
1840 |
}
|
sl@0
|
1841 |
else if (operation == KERecurse)
|
sl@0
|
1842 |
{
|
sl@0
|
1843 |
aSwitch = CFileMan::ERecurse;
|
sl@0
|
1844 |
}
|
sl@0
|
1845 |
else
|
sl@0
|
1846 |
{
|
sl@0
|
1847 |
TInt operationInt=0;
|
sl@0
|
1848 |
ret = GET_MANDATORY_INT_PARAMETER(aParameterName, aSection, operationInt);
|
sl@0
|
1849 |
if (ret)
|
sl@0
|
1850 |
{
|
sl@0
|
1851 |
aSwitch = (CFileMan::TSwitch) operationInt;
|
sl@0
|
1852 |
}
|
sl@0
|
1853 |
}
|
sl@0
|
1854 |
}
|
sl@0
|
1855 |
return ret;
|
sl@0
|
1856 |
}
|
sl@0
|
1857 |
|
sl@0
|
1858 |
/** Clears all arrays with history **/
|
sl@0
|
1859 |
void CT_FileManData::ClearHistory()
|
sl@0
|
1860 |
{
|
sl@0
|
1861 |
INFO_PRINTF1(_L("Clearing history!"));
|
sl@0
|
1862 |
|
sl@0
|
1863 |
iStartedHistory.ResetAndDestroy();
|
sl@0
|
1864 |
iOperationHistory.ResetAndDestroy();
|
sl@0
|
1865 |
iEndedHistory.ResetAndDestroy();
|
sl@0
|
1866 |
}
|
sl@0
|
1867 |
|
sl@0
|
1868 |
/**
|
sl@0
|
1869 |
* Creates a history entry.
|
sl@0
|
1870 |
* This method runs only from NotifyFileManStarted(), NotifyFileManOperation(), NotifyFileManEnded().
|
sl@0
|
1871 |
**/
|
sl@0
|
1872 |
void CT_FileManData::CreateHistoryRecord(THistoryData& aRecord)
|
sl@0
|
1873 |
{
|
sl@0
|
1874 |
TFileName source;
|
sl@0
|
1875 |
iFileMan->GetCurrentSource(source);
|
sl@0
|
1876 |
aRecord.iCurrentSource = source;
|
sl@0
|
1877 |
|
sl@0
|
1878 |
TFileName target;
|
sl@0
|
1879 |
iFileMan->GetCurrentTarget(target);
|
sl@0
|
1880 |
aRecord.iCurrentTarget = target;
|
sl@0
|
1881 |
|
sl@0
|
1882 |
aRecord.iCurrentEntry = iFileMan->CurrentEntry();
|
sl@0
|
1883 |
aRecord.iBytesTransferred = iFileMan->BytesTransferredByCopyStep();
|
sl@0
|
1884 |
aRecord.iCurrentAction = iFileMan->CurrentAction();
|
sl@0
|
1885 |
aRecord.iLastError = iFileMan->GetLastError();
|
sl@0
|
1886 |
aRecord.iMoreInfoAboutError = iFileMan->GetMoreInfoAboutError();
|
sl@0
|
1887 |
aRecord.iFullPath.Set( iFileMan->FullPath() );
|
sl@0
|
1888 |
aRecord.iAbbreviatedPath.Set( iFileMan->AbbreviatedPath() );
|
sl@0
|
1889 |
}
|
sl@0
|
1890 |
|
sl@0
|
1891 |
/** Reads type of notification from INI and converts it to TObserverNotifyType **/
|
sl@0
|
1892 |
TBool CT_FileManData::GetNotifyType(const TDesC& aParameterName, const TDesC& aSection, TObserverNotifyType& aType)
|
sl@0
|
1893 |
{
|
sl@0
|
1894 |
TPtrC type;
|
sl@0
|
1895 |
TBool ret=GET_MANDATORY_STRING_PARAMETER(aParameterName, aSection, type);
|
sl@0
|
1896 |
if(ret)
|
sl@0
|
1897 |
{
|
sl@0
|
1898 |
if (type == KNotifyStarted)
|
sl@0
|
1899 |
{
|
sl@0
|
1900 |
aType = ENotifyStarted;
|
sl@0
|
1901 |
}
|
sl@0
|
1902 |
else if (type == KNotifyOperation)
|
sl@0
|
1903 |
{
|
sl@0
|
1904 |
aType = ENotifyOperation;
|
sl@0
|
1905 |
}
|
sl@0
|
1906 |
else if (type == KNotifyEnded)
|
sl@0
|
1907 |
{
|
sl@0
|
1908 |
aType = ENotifyEnded;
|
sl@0
|
1909 |
}
|
sl@0
|
1910 |
else
|
sl@0
|
1911 |
{
|
sl@0
|
1912 |
ret = EFalse;
|
sl@0
|
1913 |
}
|
sl@0
|
1914 |
}
|
sl@0
|
1915 |
return ret;
|
sl@0
|
1916 |
}
|
sl@0
|
1917 |
|
sl@0
|
1918 |
/** Returns specific array of history using TObserverNotifyType value **/
|
sl@0
|
1919 |
RPointerArray<THistoryData>* CT_FileManData::GetHistoryDataByType(const TDesC& aSection)
|
sl@0
|
1920 |
{
|
sl@0
|
1921 |
TObserverNotifyType type;
|
sl@0
|
1922 |
RPointerArray<THistoryData>* history = NULL;
|
sl@0
|
1923 |
//Reads history name which must be returned.
|
sl@0
|
1924 |
if (GetNotifyType(KNotifyType(), aSection, type))
|
sl@0
|
1925 |
{
|
sl@0
|
1926 |
if(type == ENotifyStarted)
|
sl@0
|
1927 |
{
|
sl@0
|
1928 |
history = (RPointerArray<THistoryData>*)&iStartedHistory;
|
sl@0
|
1929 |
}
|
sl@0
|
1930 |
else if(type == ENotifyOperation)
|
sl@0
|
1931 |
{
|
sl@0
|
1932 |
history = (RPointerArray<THistoryData>*)&iOperationHistory;
|
sl@0
|
1933 |
}
|
sl@0
|
1934 |
else if(type == ENotifyEnded)
|
sl@0
|
1935 |
{
|
sl@0
|
1936 |
history = (RPointerArray<THistoryData>*)&iEndedHistory;
|
sl@0
|
1937 |
}
|
sl@0
|
1938 |
}
|
sl@0
|
1939 |
return history;
|
sl@0
|
1940 |
}
|
sl@0
|
1941 |
/** Reads TControl from config and converts it to TControl type **/
|
sl@0
|
1942 |
TBool CT_FileManData::GetTControlFromConfig(const TDesC& aParameterName, const TDesC& aSection, TControl& aFlag)
|
sl@0
|
1943 |
{
|
sl@0
|
1944 |
TPtrC flag;
|
sl@0
|
1945 |
TBool ret=GET_MANDATORY_STRING_PARAMETER(aParameterName, aSection, flag);
|
sl@0
|
1946 |
if(ret)
|
sl@0
|
1947 |
{
|
sl@0
|
1948 |
if (flag == KEContinue)
|
sl@0
|
1949 |
{
|
sl@0
|
1950 |
aFlag = EContinue;
|
sl@0
|
1951 |
}
|
sl@0
|
1952 |
else if (flag == KEAbort)
|
sl@0
|
1953 |
{
|
sl@0
|
1954 |
aFlag = EAbort;
|
sl@0
|
1955 |
}
|
sl@0
|
1956 |
else if (flag == KECancel)
|
sl@0
|
1957 |
{
|
sl@0
|
1958 |
aFlag = ECancel;
|
sl@0
|
1959 |
}
|
sl@0
|
1960 |
else if (flag == KERetry)
|
sl@0
|
1961 |
{
|
sl@0
|
1962 |
aFlag = ERetry;
|
sl@0
|
1963 |
}
|
sl@0
|
1964 |
else
|
sl@0
|
1965 |
{
|
sl@0
|
1966 |
ret = EFalse;
|
sl@0
|
1967 |
}
|
sl@0
|
1968 |
}
|
sl@0
|
1969 |
return ret;
|
sl@0
|
1970 |
}
|
sl@0
|
1971 |
|
sl@0
|
1972 |
/** Reads TControl and file name from INI **/
|
sl@0
|
1973 |
void CT_FileManData::ReadTControl(const TDesC& aSection)
|
sl@0
|
1974 |
{
|
sl@0
|
1975 |
TBool dataOk = ETrue;
|
sl@0
|
1976 |
if(!GetNotifyType(KNotifyType(), aSection, iObserverNotifyType))
|
sl@0
|
1977 |
{
|
sl@0
|
1978 |
dataOk = EFalse;
|
sl@0
|
1979 |
}
|
sl@0
|
1980 |
TPtrC fileName;
|
sl@0
|
1981 |
if(GET_MANDATORY_STRING_PARAMETER(KFileName(), aSection, fileName))
|
sl@0
|
1982 |
{
|
sl@0
|
1983 |
iNotifyFileName = fileName;
|
sl@0
|
1984 |
}
|
sl@0
|
1985 |
else
|
sl@0
|
1986 |
{
|
sl@0
|
1987 |
dataOk = EFalse;
|
sl@0
|
1988 |
}
|
sl@0
|
1989 |
if(!GetTControlFromConfig(KFlag(), aSection, iTControl))
|
sl@0
|
1990 |
{
|
sl@0
|
1991 |
dataOk = EFalse;
|
sl@0
|
1992 |
}
|
sl@0
|
1993 |
if(dataOk)
|
sl@0
|
1994 |
{
|
sl@0
|
1995 |
iUseTControl = ETrue;
|
sl@0
|
1996 |
}
|
sl@0
|
1997 |
}
|
sl@0
|
1998 |
|
sl@0
|
1999 |
|