|
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifdef _DEBUG |
|
17 #undef _NO_SERVER_LOGGING_ |
|
18 #endif |
|
19 |
|
20 |
|
21 |
|
22 #include <s32file.h> |
|
23 #include <bautils.h> |
|
24 #include <barsc.h> |
|
25 |
|
26 #include <msgs.rsg> |
|
27 |
|
28 #include "indexcontext.h" |
|
29 #include "MSVSERV.H" |
|
30 #include "MSVUTILS.H" |
|
31 #include "MSVRBLD.H" |
|
32 |
|
33 // will this header be expoerted to epoc\include |
|
34 #include <sqldb.h> |
|
35 #include "msvindexadapter.h" |
|
36 |
|
37 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
38 _LIT(KDBFileName,"\\messaging.db"); |
|
39 #else |
|
40 _LIT(KDBFileName,"[1000484B]messaging.db"); |
|
41 #endif |
|
42 |
|
43 _LIT(KServerResourceFile,"\\resource\\messaging\\msgs.rsc"); |
|
44 |
|
45 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
46 _LIT(KStoreDeletedFile,"\\private\\1000484b\\storedeleted.tmp"); |
|
47 #else |
|
48 _LIT(KStoreDeletedFile,"storedeleted.tmp"); |
|
49 #endif |
|
50 |
|
51 const TInt KMsvInitDelayTime = 0x00000001; // as soon as possible |
|
52 const TUid KUidMsvIndexFile = {0x10003C6B}; |
|
53 extern const TInt KMsvIndexStoreVersionNumber = 1; // See MsvIndex.cpp |
|
54 //********************************** |
|
55 // CMsvIndexContext |
|
56 //********************************** |
|
57 |
|
58 CMsvIndexContext* CMsvIndexContext::NewL(CMsvServer& aServer, MMsvContextObserver& aObserver) |
|
59 { |
|
60 CMsvIndexContext* self = CMsvIndexContext::NewLC(aServer, aObserver); |
|
61 CleanupStack::Pop(); |
|
62 return self; |
|
63 } |
|
64 |
|
65 CMsvIndexContext* CMsvIndexContext::NewLC(CMsvServer& aServer, MMsvContextObserver& aObserver) |
|
66 { |
|
67 CMsvIndexContext* self = new(ELeave)CMsvIndexContext(aServer, aObserver); |
|
68 CleanupStack::PushL(self); |
|
69 self->ConstructL(); |
|
70 return self; |
|
71 } |
|
72 |
|
73 void CMsvIndexContext::ConstructL() |
|
74 { |
|
75 iUpdateEntryStreams = new(ELeave)CMsvEntrySelection; |
|
76 iRemoveEntries = new(ELeave)CMsvEntrySelection; |
|
77 |
|
78 TFileName fileName(KServerResourceFile); |
|
79 MsvUtils::AddPathAndExtensionToResFileL(fileName); |
|
80 BaflUtils::NearestLanguageFile(iServer.FileSession(), fileName); |
|
81 |
|
82 // Load the initial index structure from resource file |
|
83 RResourceFile resource; |
|
84 resource.OpenL(iServer.FileSession(), fileName); |
|
85 CleanupClosePushL(resource); |
|
86 |
|
87 // Get ready to read resource |
|
88 |
|
89 iBuf = resource.AllocReadL(R_SERVER_INDEX_STARTUP); |
|
90 |
|
91 CleanupStack::PopAndDestroy(); //resource |
|
92 |
|
93 } |
|
94 |
|
95 CMsvIndexContext::~CMsvIndexContext() |
|
96 { |
|
97 Cancel(); |
|
98 delete iBuf; |
|
99 delete iIndexAdapter; |
|
100 delete iUpdateEntryStreams; |
|
101 delete iRemoveEntries; |
|
102 } |
|
103 |
|
104 CMsvIndexContext::CMsvIndexContext(CMsvServer& aServer, MMsvContextObserver& aObserver) |
|
105 : CActive(EPriorityStandard), iServer(aServer), iObserver(aObserver) |
|
106 { |
|
107 CActiveScheduler::Add(this); |
|
108 } |
|
109 |
|
110 |
|
111 |
|
112 // CODE USED AFTER PREQ 557. |
|
113 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
114 |
|
115 /** |
|
116 * CreateIndex() |
|
117 * |
|
118 * Code added for PREQ 557. |
|
119 */ |
|
120 void CMsvIndexContext::CreateIndexL() |
|
121 { |
|
122 __ASSERT_DEBUG(iProgress.iState == TMsvIndexLoadProgress::EIndexNotLoaded, PanicServer(EMsvBadIndexState)); |
|
123 |
|
124 DoCreateIndexL(); |
|
125 IndexLoadingCompleted(); |
|
126 } |
|
127 |
|
128 |
|
129 |
|
130 void CMsvIndexContext::IndexLoadingCompleted() |
|
131 { |
|
132 iProgress.iError = KErrNone; |
|
133 |
|
134 IndexLoaded(EMsvNullNotification); |
|
135 |
|
136 // Tell the observer that we've finshed |
|
137 iObserver.ContextComplete(KErrNone, iRunMailInit); |
|
138 } |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 /** |
|
144 * DoCreateIndexL() |
|
145 * |
|
146 * Create the index adapter object. |
|
147 * Code added in PREQ 557. |
|
148 */ |
|
149 void CMsvIndexContext::DoCreateIndexL() |
|
150 { |
|
151 // Remember stuff |
|
152 iObserverStatus = NULL; |
|
153 iRunMailInit = EFalse; |
|
154 |
|
155 // Update drive status in preferred drive list. |
|
156 TDriveState driveStatus = EMsvInvalidDriveStatus; |
|
157 for(TUint index=0; index<CMsvPreferredDriveList::GetDriveList()->Count(); index++) |
|
158 { |
|
159 UpdateDriveStatusL(index, driveStatus); |
|
160 } |
|
161 |
|
162 // Look for the current drive. |
|
163 // The first drive in the preferred drive list, whose |
|
164 // status is either EMsvMessageStoreAvailable or |
|
165 // EMsvMessageStoreUnavailable will be the current drive. |
|
166 TMsvPreferredDrive driveEntry; |
|
167 CMsvPreferredDriveList *driveList = CMsvPreferredDriveList::GetDriveList(); |
|
168 for(TInt currentDriveIndex=0; currentDriveIndex<driveList->Count(); ++currentDriveIndex) |
|
169 { |
|
170 driveEntry = (*driveList)[currentDriveIndex]; |
|
171 if( (EMsvMessageStoreAvailableStatus == driveEntry.status) || |
|
172 (EMsvMessageStoreUnavailableStatus == driveEntry.status) |
|
173 ) |
|
174 { |
|
175 // Set the current drive index to server. |
|
176 CMsvPreferredDriveList::GetDriveList()->SetCurrentDriveIndex(currentDriveIndex); |
|
177 |
|
178 TParse parse; |
|
179 TPtrC drive(TDriveUnit(driveEntry.driveNum).Name()); |
|
180 parse.Set(KMsvDefaultIndexFile2(), &drive, NULL); |
|
181 iMessageFolder = parse.DriveAndPath(); |
|
182 |
|
183 // If the drive already has a message store... |
|
184 if(EMsvMessageStoreUnavailableStatus == driveEntry.status) |
|
185 { |
|
186 // Create the database and all standard table. |
|
187 CMsvDBAdapter::CreateDBL(driveEntry.driveNum); |
|
188 |
|
189 // Update the drive status. |
|
190 CMsvPreferredDriveList::GetDriveList()->UpdateDriveStatusL(currentDriveIndex, EMsvMessageStoreAvailableStatus); |
|
191 |
|
192 ResetAndCreateNewMailStoreL(); |
|
193 iRunMailInit = ETrue; |
|
194 |
|
195 // Creating index adapter object. |
|
196 iIndexAdapter = CMsvIndexAdapter::NewL(iServer); |
|
197 |
|
198 // Get updated drive id. |
|
199 CreateStandardEntriesFromResourceFileL(KCurrentDriveId); |
|
200 iIndexAdapter->SetLocalServiceComplete(); |
|
201 } |
|
202 else |
|
203 { |
|
204 // The drive already has a message store. |
|
205 |
|
206 // Creating index adapter object. |
|
207 iIndexAdapter = CMsvIndexAdapter::NewL(iServer); |
|
208 |
|
209 ResetAndCreateNewMailStoreL(EFalse); |
|
210 } |
|
211 break; |
|
212 } |
|
213 } |
|
214 } |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 /** |
|
220 * UpdateDriveStatusL() |
|
221 * @param TUint: The index of the said drive in preferred |
|
222 * drive list. |
|
223 */ |
|
224 void CMsvIndexContext::UpdateDriveStatusL(TUint aDriveIndex, TDriveState& aStoreStatus) |
|
225 { |
|
226 aStoreStatus = EMsvInvalidDriveStatus; |
|
227 TBool deleteStore = EFalse; |
|
228 TMsvPreferredDrive driveEntry; |
|
229 CMsvPreferredDriveList::GetDriveList()->DriveInfoL(aDriveIndex, driveEntry); |
|
230 |
|
231 // Check if the media is available in the drive. |
|
232 TVolumeInfo volume; |
|
233 if (iServer.FileSession().Volume(volume, driveEntry.driveNum) != KErrNone) |
|
234 { |
|
235 CMsvPreferredDriveList::GetDriveList()->UpdateDriveStatusL(aDriveIndex, EMsvDriveDiskNotAvailableStatus); |
|
236 aStoreStatus = EMsvDriveDiskNotAvailableStatus; |
|
237 return; |
|
238 } |
|
239 |
|
240 // Validate the database. The function opens the database |
|
241 // and check its version and returns appropriate error. |
|
242 TRAPD(err, CMsvDBAdapter::ValidateDatabaseL(driveEntry.driveNum)); |
|
243 |
|
244 // If no error, database is available. |
|
245 if(KErrNone == err) |
|
246 { |
|
247 CMsvPreferredDriveList::GetDriveList()->UpdateDriveStatusL(aDriveIndex, EMsvMessageStoreAvailableStatus); |
|
248 return; |
|
249 } |
|
250 |
|
251 // If the database is not found in the drive. |
|
252 if(KErrNotFound == err) |
|
253 { |
|
254 // Check if index file exists. |
|
255 RFile file; |
|
256 TParse parse; |
|
257 TPtrC drive(TDriveUnit(driveEntry.driveNum).Name()); |
|
258 parse.Set(KMsvDefaultIndexFile2, &drive, NULL); |
|
259 TFileName indexFileName = parse.FullName(); |
|
260 err = file.Open(iServer.FileSession(), indexFileName, EFileShareAny|EFileWrite); |
|
261 //file.Close(); |
|
262 |
|
263 // If index file exists, set drive status to NOT SUPPORTED. |
|
264 if(KErrNone == err) |
|
265 { |
|
266 CPermanentFileStore* fileStoreIndex = NULL; |
|
267 TRAPD(permError, fileStoreIndex = CPermanentFileStore::FromL(file)); |
|
268 if(KErrNone == permError) |
|
269 { |
|
270 // Check if the store is corrupt. If so then delete it. |
|
271 if (fileStoreIndex->Type() != TUidType(KPermanentFileStoreLayoutUid, KUidMsvIndexFile)) |
|
272 { |
|
273 deleteStore = ETrue; |
|
274 } |
|
275 } |
|
276 // There was an error in getting a permanent filestore object. |
|
277 // Mark the message store for deletion. |
|
278 else |
|
279 { |
|
280 deleteStore = ETrue; |
|
281 } |
|
282 |
|
283 delete fileStoreIndex; |
|
284 |
|
285 //If message store is corrupted, wipe it. |
|
286 if(deleteStore) |
|
287 { |
|
288 TFileName mail2Folder = parse.DriveAndPath(); |
|
289 CFileMan* fileMan = CFileMan::NewL(iServer.FileSession()); |
|
290 // Remove the readonly attribute.. |
|
291 (void)fileMan->Attribs(mail2Folder, 0, KEntryAttReadOnly, TTime(0), CFileMan::ERecurse); |
|
292 CleanupStack::PushL(fileMan); |
|
293 //Check if the mailfolder exists.. |
|
294 TBool mail2FolderExists = BaflUtils::FileExists(iServer.FileSession(), mail2Folder); |
|
295 if(mail2FolderExists) |
|
296 { |
|
297 // Remove old message store if exists.. |
|
298 User::LeaveIfError(fileMan->RmDir(mail2Folder)); |
|
299 } |
|
300 CleanupStack::PopAndDestroy(fileMan); |
|
301 CMsvPreferredDriveList::GetDriveList()->UpdateDriveStatusL(aDriveIndex, EMsvMessageStoreUnavailableStatus); |
|
302 aStoreStatus = EMsvMessageStoreCorruptStatus; |
|
303 |
|
304 // Create store delete file in the respective drive. |
|
305 CreateStoreDeleteFile(driveEntry.driveNum); |
|
306 } |
|
307 //Else only set status as EMsvMessageStoreNotSupportedStatus. |
|
308 else |
|
309 { |
|
310 CMsvPreferredDriveList::GetDriveList()->UpdateDriveStatusL(aDriveIndex, EMsvMessageStoreNotSupportedStatus); |
|
311 aStoreStatus = EMsvMessageStoreNotSupportedStatus; |
|
312 } |
|
313 |
|
314 file.Close(); |
|
315 return; |
|
316 } |
|
317 |
|
318 // If index file does not exists, set drive status to STORE UNAVAILABLE. |
|
319 if((KErrNotFound == err) || (KErrPathNotFound == err)) |
|
320 { |
|
321 CMsvPreferredDriveList::GetDriveList()->UpdateDriveStatusL(aDriveIndex, EMsvMessageStoreUnavailableStatus); |
|
322 aStoreStatus = EMsvMessageStoreUnavailableStatus; |
|
323 return; |
|
324 } |
|
325 |
|
326 User::Leave(err); |
|
327 } |
|
328 |
|
329 //If a database exists, but is corrupt. |
|
330 if( (KSqlErrCorrupt == err) || |
|
331 (KSqlErrNotDb == err) |
|
332 ) |
|
333 { |
|
334 // If the database is corrupt, delete |
|
335 // the database and old message store. |
|
336 |
|
337 // Delete the database. |
|
338 TParse parse; |
|
339 TPtrC drive(TDriveUnit(driveEntry.driveNum).Name()); |
|
340 parse.Set(KDBFileName, &drive, NULL); |
|
341 TFileName dBFile = parse.FullName(); |
|
342 RSqlDatabase::Delete(dBFile); |
|
343 |
|
344 // Delete the message store. //ISSUE Can we use ResetAndCreateNewMailStore()? |
|
345 parse.Set(KMsvDefaultIndexFile2, &drive, NULL); |
|
346 TFileName mail2Folder = parse.DriveAndPath(); |
|
347 CFileMan* fileMan = CFileMan::NewL(iServer.FileSession()); |
|
348 // Remove the readonly attribute.. |
|
349 (void)fileMan->Attribs(mail2Folder, 0, KEntryAttReadOnly, TTime(0), CFileMan::ERecurse); |
|
350 CleanupStack::PushL(fileMan); |
|
351 //Check if the mailfolder exists.. |
|
352 TBool mail2FolderExists = BaflUtils::FileExists(iServer.FileSession(), mail2Folder); |
|
353 if( mail2FolderExists) |
|
354 { |
|
355 // Remove old message store if exists.. |
|
356 User::LeaveIfError(fileMan->RmDir(mail2Folder)); |
|
357 } |
|
358 CleanupStack::PopAndDestroy(fileMan); |
|
359 |
|
360 // Update the drive status. |
|
361 CMsvPreferredDriveList::GetDriveList()->UpdateDriveStatusL(aDriveIndex, EMsvMessageStoreUnavailableStatus); |
|
362 aStoreStatus = EMsvMessageStoreCorruptStatus; |
|
363 |
|
364 // Create store delete file in the respective drive. |
|
365 CreateStoreDeleteFile(driveEntry.driveNum); |
|
366 return; |
|
367 } |
|
368 |
|
369 //If the database version is not supported. |
|
370 if(KErrNotSupported == err) |
|
371 { |
|
372 // If the drive as old version of database. |
|
373 CMsvPreferredDriveList::GetDriveList()->UpdateDriveStatusL(aDriveIndex, EMsvMessageStoreNotSupportedStatus); |
|
374 aStoreStatus = EMsvMessageStoreNotSupportedStatus; |
|
375 return; |
|
376 } |
|
377 |
|
378 // Do not return DB error. |
|
379 if(err <= KSqlErrGeneral) |
|
380 { |
|
381 // If DB Error, return KErrGeneral. |
|
382 User::LeaveIfError(KErrGeneral); |
|
383 } |
|
384 else |
|
385 { |
|
386 User::LeaveIfError(err); |
|
387 } |
|
388 } |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 TInt CMsvIndexContext::ChangeDrive(TUint aNewDriveIndex, TRequestStatus& aStatus) |
|
394 { |
|
395 TInt err = ChangeDrive(aNewDriveIndex, ETrue, ETrue); |
|
396 |
|
397 // Remember the status which we'll complete |
|
398 aStatus = KRequestPending; |
|
399 iObserverStatus = &aStatus; |
|
400 return err; |
|
401 } |
|
402 |
|
403 |
|
404 |
|
405 void CMsvIndexContext::ChangeDriveCompleted(TInt aError) |
|
406 { |
|
407 // Remember error |
|
408 iProgress.iError = aError; |
|
409 |
|
410 if (iObserverStatus) |
|
411 { |
|
412 User::RequestComplete(iObserverStatus, aError); |
|
413 } |
|
414 } |
|
415 |
|
416 |
|
417 |
|
418 /** |
|
419 * ChangeDriveL() |
|
420 * @param TUint: Index of the new current drive in the preferred drive list. |
|
421 * @param TBool: True, if old drive is still present in the preferred drive list. |
|
422 * False, otherwise. |
|
423 * |
|
424 */ |
|
425 TInt CMsvIndexContext::ChangeDrive(TUint aNewDriveIndex, TBool aIsRemovePartial /*= ETrue*/, TBool aAsync /*=EFalse */) |
|
426 { |
|
427 TDriveNumber newDriveNumber; |
|
428 TRAPD(err, DoChangeDriveL(aNewDriveIndex, aIsRemovePartial, newDriveNumber)); |
|
429 |
|
430 // Add a function ChangeDriveComplete() in server |
|
431 // which should be called here. The function should |
|
432 // run mailInit and recreate backup object. |
|
433 iObserver.ChangeDriveComplete(err, iRunMailInit, newDriveNumber); |
|
434 |
|
435 if(aAsync) |
|
436 { |
|
437 iStatus = KRequestPending; |
|
438 SetActive(); |
|
439 TRequestStatus* st = &iStatus; |
|
440 User::RequestComplete(st, err); |
|
441 } |
|
442 return err; |
|
443 } |
|
444 |
|
445 |
|
446 |
|
447 void CMsvIndexContext::DoChangeDriveL(TUint aNewDriveIndex, TBool aIsRemovePartial, TDriveNumber& aNewDriveNumber) |
|
448 { |
|
449 iObserverStatus = NULL; |
|
450 TMsvPreferredDrive driveEntry; |
|
451 CMsvPreferredDriveList::GetDriveList()->DriveInfoL(aNewDriveIndex, driveEntry); |
|
452 |
|
453 aNewDriveNumber = driveEntry.driveNum; |
|
454 if(EMsvMessageStoreUnavailableStatus == driveEntry.status) |
|
455 { |
|
456 // Create the database and all standard table. |
|
457 CMsvDBAdapter::CreateDBL(driveEntry.driveNum); |
|
458 |
|
459 // Update the drive status. |
|
460 CMsvPreferredDriveList::GetDriveList()->UpdateDriveStatusL(aNewDriveIndex, EMsvMessageStoreAvailableStatus); |
|
461 |
|
462 TParse parse; |
|
463 TPtrC drive(TDriveUnit(driveEntry.driveNum).Name()); |
|
464 parse.Set(KMsvDefaultIndexFile2(), &drive, NULL); |
|
465 iMessageFolder = parse.DriveAndPath(); |
|
466 |
|
467 ResetAndCreateNewMailStoreL(); |
|
468 iRunMailInit = ETrue; |
|
469 |
|
470 // Perform ChangeDrive operation. |
|
471 iIndexAdapter->ChangeDriveL(aNewDriveIndex, aIsRemovePartial); |
|
472 |
|
473 // Read initial entries from resources |
|
474 CreateStandardEntriesFromResourceFileL(KCurrentDriveId); |
|
475 iIndexAdapter->SetLocalServiceComplete(); |
|
476 } |
|
477 else |
|
478 { |
|
479 // Update the message folder local variable. |
|
480 TParse parse; |
|
481 TPtrC drive(TDriveUnit(driveEntry.driveNum).Name()); |
|
482 parse.Set(KMsvDefaultIndexFile2(), &drive, NULL); |
|
483 iMessageFolder = parse.DriveAndPath(); |
|
484 |
|
485 ResetAndCreateNewMailStoreL(EFalse); |
|
486 // Perform ChangeDrive operation. |
|
487 iIndexAdapter->ChangeDriveL(aNewDriveIndex, aIsRemovePartial); |
|
488 iRunMailInit = EFalse; |
|
489 } |
|
490 |
|
491 // Create service directories in new drive. |
|
492 TRAP_IGNORE(DoCreateServiceDirsL(KCurrentDriveId)); |
|
493 |
|
494 TRAP_IGNORE(LocalizeStandardFoldersL()); |
|
495 } |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 void CMsvIndexContext::GetInPreparationIds(TUint aDriveId) |
|
501 { |
|
502 delete iRemoveEntries; |
|
503 iRemoveEntries = new CMsvEntrySelection; |
|
504 |
|
505 iIndexAdapter->GetInPreparationIds(*iRemoveEntries, aDriveId); |
|
506 } |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 /** |
|
512 * CreateStandardEntriesFromResourceFileL() |
|
513 * @param None: |
|
514 * |
|
515 * Will read messaging resource file and create entries. |
|
516 */ |
|
517 void CMsvIndexContext::CreateStandardEntriesFromResourceFileL(TUint aDriveId) |
|
518 { |
|
519 // Read initial entries from resources |
|
520 TResourceReader reader; |
|
521 reader.SetBuffer(iBuf); |
|
522 const TInt numberOfEntries = reader.ReadInt16(); |
|
523 |
|
524 for (TInt index=0; index < numberOfEntries; ++index) |
|
525 { |
|
526 TMsvEntry newEntry; |
|
527 |
|
528 // Values from resource file |
|
529 newEntry.iId = MaskTMsvId(aDriveId, reader.ReadInt32()); |
|
530 newEntry.iParentId = reader.ReadInt32(); |
|
531 newEntry.iServiceId = reader.ReadInt32(); |
|
532 newEntry.iType.iUid = reader.ReadInt32(); |
|
533 newEntry.iMtm.iUid = reader.ReadInt32(); |
|
534 newEntry.iData = reader.ReadInt32(); |
|
535 newEntry.iDescription.Set(reader.ReadTPtrC()); |
|
536 newEntry.iDetails.Set(reader.ReadTPtrC()); |
|
537 newEntry.iDate.UniversalTime(); |
|
538 newEntry.iSize=0; |
|
539 |
|
540 // Create the new entry. |
|
541 // This is required to create associated service directory. |
|
542 User::LeaveIfError(iServer.AddEntry(this, newEntry, KMsvServerId, EFalse)); |
|
543 } |
|
544 } |
|
545 |
|
546 #else // #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
547 |
|
548 |
|
549 |
|
550 void CMsvIndexContext::CreateIndexL(TInt aDrive, TRequestStatus& aStatus) |
|
551 { |
|
552 // Kick off index loading |
|
553 CreateIndexL(aDrive, EFalse); |
|
554 // Remember the status which we'll complete |
|
555 aStatus = KRequestPending; |
|
556 iObserverStatus = &aStatus; |
|
557 } |
|
558 |
|
559 |
|
560 |
|
561 void CMsvIndexContext::CreateIndexL(TInt aDrive, TBool aSync) |
|
562 { |
|
563 __ASSERT_DEBUG(iProgress.iState == TMsvIndexLoadProgress::EIndexNotLoaded, PanicServer(EMsvBadIndexState)); |
|
564 __ASSERT_DEBUG(RFs::IsValidDrive(aDrive), PanicServer(EMsvInvalidDrive)); |
|
565 |
|
566 // Remember stuff |
|
567 iConfig.iDrive = TDriveUnit(aDrive); |
|
568 iObserverStatus = NULL; |
|
569 iRunMailInit = EFalse; |
|
570 |
|
571 // Set the drive for this index file |
|
572 TParse parse; |
|
573 TPtrC drive(iConfig.iDrive.Name()); |
|
574 parse.Set(KMsvDefaultIndexFile2(), &drive, NULL); |
|
575 |
|
576 // Construct the message folder name etc |
|
577 iMessageFolder = parse.DriveAndPath(); |
|
578 TFileName indexFileName = parse.FullName(); |
|
579 // Adding the new code |
|
580 // Now we are creating the new database adapter. |
|
581 // Find out if the db exists |
|
582 // Construct the db file name |
|
583 parse.Set(KDBFileName, &drive, NULL); |
|
584 TFileName dBFile = parse.FullName(); |
|
585 RSqlDatabase db; |
|
586 TRAPD(err,db.OpenL(dBFile)); |
|
587 TBool create=EFalse; |
|
588 |
|
589 // Database may be corrupted, so delete the old database and create a new one. |
|
590 if(err == KSqlErrCorrupt || err == KSqlErrNotDb ) |
|
591 { |
|
592 RSqlDatabase::Delete(dBFile); |
|
593 create = ETrue; |
|
594 } |
|
595 // Database is not present. We need to check if the store is an old one. |
|
596 // If it is, we check if it is corrupt. |
|
597 // If it is corrupt we can safely delete the store and create a new one |
|
598 // in its place. If not, then we leave with KErrNotSupported stating that |
|
599 // the old store is incompatible with this implementation of the message |
|
600 // store which uses an SQL database for the index. |
|
601 else if( err == KErrNotFound) |
|
602 { |
|
603 // Check if any of the old index files exist in the Mail2 folder. |
|
604 TParse parse1; |
|
605 parse1.Set(KMsvDefaultIndexFile, &drive, NULL); //old version of index file |
|
606 if( BaflUtils::FileExists(iServer.FileSession(), parse1.FullName()) || |
|
607 BaflUtils::FileExists(iServer.FileSession(), indexFileName)) |
|
608 { |
|
609 // Open index store. |
|
610 RFile file; |
|
611 TInt error = file.Open(iServer.FileSession(), indexFileName, EFileShareAny|EFileWrite); |
|
612 |
|
613 // Check if we have an old 'legacy' version of the index file. |
|
614 CPermanentFileStore* index = NULL; |
|
615 TRAPD(permError, index = CPermanentFileStore::FromL(file)); |
|
616 CleanupStack::PushL(index); |
|
617 if (KErrNone == permError) |
|
618 { |
|
619 // Check if the store is corrupt. If so then delete it. |
|
620 if (index->Type() != TUidType(KPermanentFileStoreLayoutUid, KUidMsvIndexFile)) |
|
621 { |
|
622 create = ETrue; |
|
623 } |
|
624 } |
|
625 // There was an error in getting a permanent filestore object. |
|
626 // Delete the message store. |
|
627 else |
|
628 { |
|
629 create = ETrue; |
|
630 } |
|
631 |
|
632 CleanupStack::PopAndDestroy(); //index |
|
633 file.Close(); |
|
634 |
|
635 // If the old store is valid, then throw an error. |
|
636 if(!create) |
|
637 { |
|
638 User::Leave(KErrNotSupported); |
|
639 } |
|
640 } |
|
641 //Index file does not exist in Mail2 folder. Go ahead with database creation. |
|
642 else |
|
643 { |
|
644 create = ETrue; |
|
645 } |
|
646 } |
|
647 else |
|
648 { |
|
649 db.Close(); |
|
650 User::LeaveIfError(err); |
|
651 } |
|
652 |
|
653 db.Close(); |
|
654 |
|
655 if(!create) |
|
656 { |
|
657 // Check for database version. |
|
658 TRAP(err, CMsvDBAdapter::ValidateDatabaseL(dBFile)); |
|
659 User::LeaveIfError(err); |
|
660 |
|
661 iIndexAdapter = CMsvIndexAdapter::OpenL(iServer, dBFile); |
|
662 ResetAndCreateNewMailStoreL(EFalse); |
|
663 } |
|
664 else |
|
665 { |
|
666 iIndexAdapter = CMsvIndexAdapter::NewL(iServer, dBFile); |
|
667 ResetAndCreateNewMailStoreL(); |
|
668 CreateStoreDeleteFile(); |
|
669 iRunMailInit = ETrue; |
|
670 |
|
671 TResourceReader reader; |
|
672 reader.SetBuffer(iBuf); |
|
673 // Read initial entries from resources |
|
674 const TInt numberOfEntries = reader.ReadInt16(); |
|
675 for (TInt index=0; index<numberOfEntries; ++index) |
|
676 { |
|
677 TMsvEntry newEntry; |
|
678 // Values from resource file |
|
679 newEntry.iId = reader.ReadInt32(); |
|
680 newEntry.iParentId = reader.ReadInt32(); |
|
681 newEntry.iServiceId = reader.ReadInt32(); |
|
682 newEntry.iType.iUid = reader.ReadInt32(); |
|
683 newEntry.iMtm.iUid = reader.ReadInt32(); |
|
684 newEntry.iData = reader.ReadInt32(); |
|
685 newEntry.iDescription.Set(reader.ReadTPtrC()); |
|
686 newEntry.iDetails.Set(reader.ReadTPtrC()); |
|
687 newEntry.iDate.UniversalTime(); |
|
688 newEntry.iSize=0; |
|
689 |
|
690 // Create the new entry |
|
691 // This is required to create associated service directory. |
|
692 TInt error = iServer.AddEntry(this, newEntry, KMsvServerId, EFalse); |
|
693 User::LeaveIfError(error); |
|
694 } |
|
695 iIndexAdapter->SetLocalServiceComplete(); |
|
696 |
|
697 } |
|
698 if(aSync) |
|
699 { |
|
700 IndexLoadingCompleted(KErrNone); |
|
701 } |
|
702 else |
|
703 { |
|
704 iStatus = KRequestPending; |
|
705 SetActive(); |
|
706 TRequestStatus* st = &iStatus; |
|
707 User::RequestComplete(st, KErrNone);// do we need to propogate the error from adapter to here |
|
708 } |
|
709 } |
|
710 |
|
711 |
|
712 |
|
713 TInt CMsvIndexContext::LoadStoreConfig(TBool aLoad) |
|
714 // |
|
715 // In-between function to save the cost of a trap |
|
716 // |
|
717 { |
|
718 TRAPD(error, aLoad ? CMsvServer::CurrentConfigL(iServer.FileSession(), iConfig) : DoStoreConfigL()); |
|
719 return error; |
|
720 } |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 void CMsvIndexContext::DoStoreConfigL() |
|
726 { |
|
727 // we only want to store the config file if it has changed, |
|
728 // we also don't care about UniqueIDs for the internal drive |
|
729 if(iConfig.iDebug!=iConfig.iDebugAsLoaded || |
|
730 iConfig.iDrive!=iConfig.iDriveAsLoaded || |
|
731 (iConfig.iDrive!=iServer.FileSession().GetSystemDrive() && iConfig.iUniqueID!=iConfig.iUniqueIDAsLoaded)) |
|
732 { |
|
733 TChar driveChar= iServer.FileSession().GetSystemDriveChar(); |
|
734 TBuf<2> systemDrive; |
|
735 systemDrive.Append(driveChar); |
|
736 systemDrive.Append(KDriveDelimiter); |
|
737 TPath pathName(systemDrive); |
|
738 pathName.Append(KServerINIFile); |
|
739 CDictionaryFileStore *store=CDictionaryFileStore::OpenLC(iServer.FileSession(),pathName,KNullUid); |
|
740 RDictionaryWriteStream stream; |
|
741 stream.AssignLC(*store, KUidMsvMessageDriveStream); |
|
742 |
|
743 stream.WriteUint8L(KMsvMessageDriveStreamVersionNumber); // version number |
|
744 stream << iConfig.iDrive.Name(); |
|
745 stream.WriteUint32L(iConfig.iUniqueID); |
|
746 stream.WriteInt8L(iConfig.iDebug); |
|
747 |
|
748 stream.CommitL(); |
|
749 store->CommitL(); |
|
750 CleanupStack::PopAndDestroy(2,store); // stream, store |
|
751 } |
|
752 } |
|
753 |
|
754 |
|
755 |
|
756 void CMsvIndexContext::IndexLoadingCompleted(TInt aError) |
|
757 { |
|
758 // Remember error |
|
759 iProgress.iError = aError; |
|
760 |
|
761 // If there is no index at this point it's because the index loading is synchronous |
|
762 if (!iIndexAdapter && !aError) |
|
763 return; |
|
764 |
|
765 // If there was an error, wipe the message folder and create a blank one |
|
766 if (aError == KErrCorrupt || aError == KErrOverflow || aError == KErrNotFound || aError == KErrEof || aError == KErrNotSupported) |
|
767 { |
|
768 #ifndef _NO_SERVER_LOGGING_ |
|
769 iServer.Log(_L("Index corrupted, starting rebuild (%d)"), aError); |
|
770 #endif |
|
771 // Note: Following doesn't send any notifications |
|
772 IndexFailedToLoad(KErrNone); |
|
773 |
|
774 //Create a file to let the UI know that the store has been deleted. |
|
775 CreateStoreDeleteFile(); |
|
776 } |
|
777 |
|
778 // Get the drive Id |
|
779 if (!aError) |
|
780 { |
|
781 TVolumeInfo volume; |
|
782 aError = iServer.FileSession().Volume(volume, TInt(iConfig.iDrive)); |
|
783 if (!aError) |
|
784 { |
|
785 iConfig.iUniqueID = volume.iUniqueID; |
|
786 } |
|
787 } |
|
788 |
|
789 // If we are not rebuilding, then inform clients of outcome |
|
790 if (aError) |
|
791 IndexFailedToLoad(aError); |
|
792 else |
|
793 IndexLoaded(EMsvNullNotification); |
|
794 |
|
795 // Tell the observer that we've finshed |
|
796 iObserver.ContextComplete(aError, iRunMailInit); |
|
797 |
|
798 if (iObserverStatus) |
|
799 User::RequestComplete(iObserverStatus, aError); |
|
800 } |
|
801 |
|
802 |
|
803 |
|
804 void CMsvIndexContext::IndexFailedToLoad(TInt aError) |
|
805 // |
|
806 // The index has failed to load. Remove partially created in-memory index |
|
807 // |
|
808 { |
|
809 // Update progress |
|
810 iProgress.iError = aError; |
|
811 delete iIndexAdapter; |
|
812 iIndexAdapter = NULL; |
|
813 iProgress.iState = TMsvIndexLoadProgress::EIndexNotLoaded; |
|
814 if (aError) |
|
815 iServer.NotifyChanged(EMsvIndexFailedToLoad, KMsvNullIndexEntryId, aError); |
|
816 } |
|
817 |
|
818 |
|
819 #endif // #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
820 |
|
821 |
|
822 |
|
823 |
|
824 void CMsvIndexContext::IndexLoaded(TMsvServerChangeNotificationType aNotification) |
|
825 // |
|
826 // The index has been successfully loaded |
|
827 // |
|
828 { |
|
829 iProgress.iState = TMsvIndexLoadProgress::EIndexComplete; |
|
830 iProgress.iError = KErrNone; |
|
831 |
|
832 // Remove any orphaned entries |
|
833 __ASSERT_DEBUG(iRemoveEntries->Count()==0, PanicServer(EMsvRemovingOrphanedEntries)); |
|
834 iIndexAdapter->GetInPreparationIds(*iRemoveEntries); |
|
835 |
|
836 // kick off the delay timer, this will allow the message server to make |
|
837 // any changes it wants to the index on startup, currently it will |
|
838 // remove any entries in iRemoveEntries and try and localize the standard folders. |
|
839 if (!iServer.Delay().IsActive()) |
|
840 iServer.Delay().After(KMsvInitDelayTime); |
|
841 |
|
842 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
843 TRAP_IGNORE(DoCreateServiceDirsL(KCurrentDriveId)); |
|
844 #else |
|
845 TRAP_IGNORE(DoCreateServiceDirsL()); |
|
846 #endif |
|
847 |
|
848 // Queue notification - it will be sent before EMsvIndexLoaded |
|
849 // when we can guarantee that index is fully loaded |
|
850 if (aNotification != EMsvNullNotification) |
|
851 iServer.QueueNotifyChanged(aNotification); |
|
852 } |
|
853 |
|
854 void CMsvIndexContext::LocalizeStandardFoldersL() |
|
855 { |
|
856 // Get ready to read resource |
|
857 TResourceReader reader; |
|
858 reader.SetBuffer(iBuf); |
|
859 |
|
860 // Read initial entries from resources |
|
861 const TInt numberOfEntries = reader.ReadInt16(); |
|
862 for (TInt ii=0; ii<numberOfEntries; ii++) |
|
863 { |
|
864 TMsvEntry resourceEntry; |
|
865 |
|
866 // Values from resource file |
|
867 resourceEntry.iId = reader.ReadInt32(); |
|
868 resourceEntry.iParentId = reader.ReadInt32(); |
|
869 resourceEntry.iServiceId = reader.ReadInt32(); |
|
870 resourceEntry.iType.iUid = reader.ReadInt32(); |
|
871 resourceEntry.iMtm.iUid = reader.ReadInt32(); |
|
872 resourceEntry.iData = reader.ReadInt32(); |
|
873 resourceEntry.iDescription.Set(reader.ReadTPtrC()); |
|
874 resourceEntry.iDetails.Set(reader.ReadTPtrC()); |
|
875 |
|
876 // Add Universal time and initialise size |
|
877 resourceEntry.iDate.UniversalTime(); |
|
878 resourceEntry.iSize=0; |
|
879 TMsvEntry *entry; |
|
880 |
|
881 // 557. Will by default pick entries from current drive. |
|
882 TInt error = iIndexAdapter->GetEntry(resourceEntry.Id(),entry); |
|
883 if(error ==KErrNone) |
|
884 { |
|
885 TMsvEntry newEntry= *entry; |
|
886 TBool changed=EFalse; |
|
887 if(newEntry.iDescription.Compare(resourceEntry.iDescription)!=0) |
|
888 { |
|
889 newEntry.iDescription.Set(resourceEntry.iDescription); |
|
890 changed=ETrue; |
|
891 } |
|
892 if(newEntry.iDetails.Compare(resourceEntry.iDetails)!=0) |
|
893 { |
|
894 newEntry.iDetails.Set(resourceEntry.iDetails); |
|
895 changed=ETrue; |
|
896 } |
|
897 |
|
898 // ignore the error we don't want to fail just because the |
|
899 // inbox isn't in the right language, we will try again next |
|
900 // time the server starts. |
|
901 if(changed!=EFalse) |
|
902 { |
|
903 iIndexAdapter->LockEntry(newEntry.Id()); |
|
904 iIndexAdapter->ChangeEntryInternal(newEntry, KMsvServerId); |
|
905 iIndexAdapter->ReleaseEntry(newEntry.Id()); |
|
906 } |
|
907 } |
|
908 else if( error == KErrNotFound ) |
|
909 { |
|
910 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
911 resourceEntry.SetParent(MaskTMsvId(KCurrentDriveId, resourceEntry.iParentId)); |
|
912 resourceEntry.SetId(MaskTMsvId(KCurrentDriveId, resourceEntry.iId)); |
|
913 #endif |
|
914 // Create the new entry |
|
915 iServer.AddEntry(this, resourceEntry, KMsvServerId, EFalse); |
|
916 } |
|
917 } |
|
918 } |
|
919 |
|
920 |
|
921 |
|
922 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
923 void CMsvIndexContext::DoCreateServiceDirsL(TUint aDriveId) |
|
924 #else |
|
925 void CMsvIndexContext::DoCreateServiceDirsL() |
|
926 #endif |
|
927 { |
|
928 CMsvEntryFilter* filter = CMsvEntryFilter::NewLC(); |
|
929 filter->SetOrder(TMsvSelectionOrdering(0, EMsvSortByNone, ETrue)); |
|
930 |
|
931 CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; |
|
932 CleanupStack::PushL(selection); |
|
933 TInt err = KErrNone; |
|
934 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
935 err = iIndexAdapter->GetChildrenId(MaskTMsvId(aDriveId, KMsvRootIndexEntryId), *filter, *selection); |
|
936 #else |
|
937 err = iIndexAdapter->GetChildrenId(KMsvRootIndexEntryId, *filter, *selection); |
|
938 #endif |
|
939 |
|
940 // make sure the service directories are there |
|
941 if (err == KErrNone) |
|
942 { |
|
943 TInt count = selection->Count(); |
|
944 while (count--) |
|
945 { |
|
946 TFileName filename; |
|
947 filename.Copy(iMessageFolder); |
|
948 |
|
949 TMsvId id = selection->At(count); |
|
950 |
|
951 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
952 MsvUtils::ConstructEntryName(UnmaskTMsvId(id), MaskTMsvId(aDriveId, id), filename, MsvUtils::EPath); |
|
953 #else |
|
954 MsvUtils::ConstructEntryName(id, id, filename, MsvUtils::EPath); |
|
955 #endif |
|
956 |
|
957 iServer.FileSession().MkDir(filename); // ignore any error |
|
958 } |
|
959 } |
|
960 |
|
961 CleanupStack::PopAndDestroy(2); // selection, filter |
|
962 } |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 void CMsvIndexContext::DoCancel() |
|
968 { |
|
969 if (iIndexAdapter) |
|
970 iIndexAdapter->Cancel(); |
|
971 if (iObserverStatus) |
|
972 User::RequestComplete(iObserverStatus, KErrCancel); |
|
973 } |
|
974 |
|
975 void CMsvIndexContext::RunL() |
|
976 { |
|
977 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
978 // In 557, ChangeDriveL() can be asynchronous, |
|
979 // but CreateIndexL() will always be synchronous. |
|
980 ChangeDriveCompleted(iStatus.Int()); |
|
981 #else |
|
982 IndexLoadingCompleted(iStatus.Int()); |
|
983 #endif |
|
984 } |
|
985 |
|
986 const TMsvIndexLoadProgress& CMsvIndexContext::Progress() |
|
987 { |
|
988 // Get the progress from the index first |
|
989 if (iIndexAdapter) |
|
990 iProgress.iIndex = iIndexAdapter->Progress(); |
|
991 return iProgress; |
|
992 } |
|
993 |
|
994 |
|
995 |
|
996 TBool CMsvIndexContext::GetAndClearIndexCorruptFlagL() |
|
997 { |
|
998 RFs& fs=iServer.FileSession(); |
|
999 |
|
1000 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
1001 TDriveNumber driveNum = CMsvPreferredDriveList::GetDriveList()->CurrentDriveNumber(); |
|
1002 User::LeaveIfError(fs.SetSessionToPrivate(driveNum)); |
|
1003 #else |
|
1004 User::LeaveIfError(fs.SetSessionToPrivate(Config().iDrive)); |
|
1005 #endif // #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
1006 |
|
1007 TInt error=fs.Delete(KStoreDeletedFile); |
|
1008 if(error !=KErrNone && error != KErrNotFound) |
|
1009 { |
|
1010 User::Leave(error); |
|
1011 } |
|
1012 // at this point error is either KErrNone if the file indicating the index |
|
1013 // was corrupt is present and has been deleted or KErrNotFound if the file |
|
1014 // was not present. The function returns ETrue if the file was present and |
|
1015 // therefore the index was corrupt and the user should be informed. |
|
1016 return error == KErrNone ? ETrue : EFalse; |
|
1017 } |
|
1018 |
|
1019 |
|
1020 |
|
1021 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
1022 void CMsvIndexContext::CreateStoreDeleteFile(TDriveNumber aDriveNum) |
|
1023 #else |
|
1024 void CMsvIndexContext::CreateStoreDeleteFile() |
|
1025 #endif |
|
1026 { |
|
1027 |
|
1028 #if (!defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
1029 TDriveNumber aDriveNum = (TDriveNumber)(TInt) Config().iDrive; |
|
1030 #endif |
|
1031 |
|
1032 RFs& fs = iServer.FileSession(); |
|
1033 |
|
1034 TInt err = fs.SetSessionToPrivate(aDriveNum); |
|
1035 if(err == KErrNone) |
|
1036 { |
|
1037 RFile storeDeletedFile; |
|
1038 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
1039 TParse parse; |
|
1040 TPtrC drive(TDriveUnit(aDriveNum).Name()); |
|
1041 parse.Set(KStoreDeletedFile, &drive, NULL); |
|
1042 TFileName fileName = parse.FullName(); |
|
1043 #else |
|
1044 TFileName fileName(KStoreDeletedFile); |
|
1045 #endif // #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
1046 |
|
1047 err = storeDeletedFile.Replace(fs, fileName, EFileShareExclusive); |
|
1048 if(err == KErrNone) |
|
1049 { |
|
1050 _LIT8(KMsvIndexStoreDeleted,"StoreDeleted"); |
|
1051 storeDeletedFile.Write(KMsvIndexStoreDeleted); |
|
1052 } |
|
1053 storeDeletedFile.Close(); |
|
1054 } |
|
1055 } |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 // Reset Mail Store(Mail2) so that old messages are deleted when new index file created.. |
|
1061 void CMsvIndexContext::ResetAndCreateNewMailStoreL(TBool aDelete) |
|
1062 { |
|
1063 CFileMan* fileMan = CFileMan::NewL(iServer.FileSession()); |
|
1064 CleanupStack::PushL(fileMan); |
|
1065 |
|
1066 if(aDelete) |
|
1067 { |
|
1068 //Check if the mailfolder exists.. |
|
1069 if(BaflUtils::FileExists(iServer.FileSession(), iMessageFolder)) |
|
1070 { |
|
1071 // Remove the readonly attribute.. |
|
1072 (void)fileMan->Attribs(iMessageFolder,0, KEntryAttReadOnly, TTime(0), CFileMan::ERecurse); |
|
1073 // Remove old message store if exists.. |
|
1074 User::LeaveIfError(fileMan->RmDir(iMessageFolder)); |
|
1075 } |
|
1076 } |
|
1077 |
|
1078 // Create the folder for the message store |
|
1079 TInt err = iServer.FileSession().MkDirAll(iMessageFolder); |
|
1080 if(err != KErrAlreadyExists) |
|
1081 { |
|
1082 User::LeaveIfError(err); |
|
1083 } |
|
1084 CleanupStack::PopAndDestroy(fileMan); |
|
1085 } |