filebrowser/engine/FBFileOps.cpp
branchRCL_3
changeset 22 fad26422216a
parent 21 b3cee849fa46
child 23 f8280f3bfeb7
equal deleted inserted replaced
21:b3cee849fa46 22:fad26422216a
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "FBFileOps.h"
       
    20 #include "FBFileUtils.h"
       
    21 #include "engine.h"
       
    22 #include "FBTraces.h"
       
    23 
       
    24 #ifndef FILEBROWSER_LITE
       
    25   #include "FBFileOpClient.h"
       
    26 #endif  
       
    27 
       
    28 #include <f32file.h>
       
    29 #include <bautils.h>
       
    30 #include <eikenv.h>
       
    31 #include <babackup.h>
       
    32 
       
    33 const TInt KSecureBackupStartDelay = 750000;
       
    34 const TInt KSecureBackupLoopDelay = 100000;
       
    35 const TInt KSecureBackupEndDelay = 200000;
       
    36 const TInt KMaxFileLockAttempts = 3;
       
    37 
       
    38 
       
    39 // ================= MEMBER FUNCTIONS =======================
       
    40 
       
    41 CFileBrowserFileOps* CFileBrowserFileOps::NewL(CEngine* aEngine)
       
    42 	{
       
    43 	CFileBrowserFileOps* self = new(ELeave) CFileBrowserFileOps(aEngine);
       
    44 	CleanupStack::PushL(self);
       
    45 	self->ConstructL();
       
    46 	CleanupStack::Pop();
       
    47 	return self;
       
    48 	}
       
    49 
       
    50 // --------------------------------------------------------------------------------------------
       
    51 
       
    52 CFileBrowserFileOps::CFileBrowserFileOps(CEngine* aEngine) : iEngine(aEngine)
       
    53 	{
       
    54 	}
       
    55 
       
    56 // --------------------------------------------------------------------------------------------
       
    57 
       
    58 void CFileBrowserFileOps::ConstructL()
       
    59 	{
       
    60 	iRecursiveState = EFileOpInvalid;
       
    61 	iSecureBackUpActive = EFalse;
       
    62 	iFileCommandActivatedSecureBackup = EFalse;
       
    63 	
       
    64     User::LeaveIfError(iFs.Connect());
       
    65     iFileMan = CFileMan::NewL( iFs, this );
       
    66 	}
       
    67 
       
    68 // --------------------------------------------------------------------------------------------
       
    69 
       
    70 CFileBrowserFileOps::~CFileBrowserFileOps()
       
    71 	{
       
    72 	if (iSBEClient)
       
    73 	    delete iSBEClient;
       
    74 	
       
    75     #ifndef FILEBROWSER_LITE	
       
    76         if (iFileOpClient)
       
    77             delete iFileOpClient;
       
    78     #endif	
       
    79 
       
    80     delete iFileMan;
       
    81     iFs.Close();    
       
    82     }
       
    83 
       
    84 // --------------------------------------------------------------------------------------------
       
    85 
       
    86 TInt CFileBrowserFileOps::ActivateSecureBackUpViaFileOp()
       
    87     {
       
    88     iFileManObserverResult = MFileManObserver::EContinue;
       
    89     // if already activate by a file command, return ok
       
    90     if (iFileCommandActivatedSecureBackup)
       
    91         return KErrNone;
       
    92     else
       
    93         {
       
    94         // if secure backup is already active, disable it first, because it may in wrong state
       
    95         if (iSecureBackUpActive)
       
    96             DeActivateSecureBackUp();
       
    97         }
       
    98     
       
    99     // try to activate full secure backup
       
   100     TInt err = ActivateSecureBackUp(conn::EBURBackupFull, conn::EBackupBase);
       
   101     
       
   102     if (err == KErrNone)
       
   103         iFileCommandActivatedSecureBackup = ETrue;
       
   104     
       
   105     return err;
       
   106     }
       
   107 
       
   108 // --------------------------------------------------------------------------------------------
       
   109 
       
   110 TInt CFileBrowserFileOps::DeActivateSecureBackUpViaFileOp()
       
   111     {
       
   112     TInt err(KErrGeneral);
       
   113     iFileManObserverResult = MFileManObserver::EContinue;
       
   114     
       
   115     // if activate by a file command, try to reactivate it
       
   116     if (iFileCommandActivatedSecureBackup)
       
   117         {
       
   118         err = DeActivateSecureBackUp();
       
   119         
       
   120         // even if it fails, forget the state
       
   121         iFileCommandActivatedSecureBackup = EFalse;
       
   122         }
       
   123 
       
   124     return err;
       
   125     }    
       
   126     
       
   127 // --------------------------------------------------------------------------------------------
       
   128 
       
   129 TInt CFileBrowserFileOps::ActivateSecureBackUp(conn::TBURPartType aPartType, conn::TBackupIncType aBackupIncType)
       
   130     {
       
   131     iFileManObserverResult = MFileManObserver::EContinue;
       
   132     // check for invalid parameters
       
   133     if (aPartType == conn::EBURNormal || aBackupIncType == conn::ENoBackup)
       
   134         User::Panic(_L("Inv.Usage.SE"), 532);
       
   135     
       
   136     TInt err(KErrNone);
       
   137     
       
   138     if (!iSBEClient)
       
   139         {
       
   140         TRAP(err, iSBEClient = conn::CSBEClient::NewL());
       
   141         if (err != KErrNone)
       
   142             return err;
       
   143         }
       
   144     
       
   145     TDriveList driveList;
       
   146     err = iFs.DriveList(driveList);
       
   147     
       
   148     if (err == KErrNone)
       
   149         {
       
   150         // make sure that the application has a system status to prevent getting shut down events
       
   151         iEngine->EikonEnv()->SetSystem(ETrue);
       
   152     
       
   153         // activating secure back up removes locks from files which respect this fuctionality                
       
   154         TRAP(err, iSBEClient->SetBURModeL(driveList, aPartType, aBackupIncType));
       
   155         
       
   156         if (err == KErrNone)
       
   157             {
       
   158             iSecureBackUpActive = ETrue;
       
   159             User::After(KSecureBackupStartDelay); // a short delay to wait to activate
       
   160             }
       
   161         }
       
   162 
       
   163     return err;
       
   164     }
       
   165 
       
   166 // --------------------------------------------------------------------------------------------
       
   167 
       
   168 TInt CFileBrowserFileOps::DeActivateSecureBackUp()
       
   169     {
       
   170     TInt err(KErrNone);
       
   171     
       
   172     if (!iSBEClient)
       
   173         {
       
   174         TRAP(err, iSBEClient = conn::CSBEClient::NewL());
       
   175         if (err != KErrNone)
       
   176             return err;
       
   177         
       
   178         // make sure that the application has a system status
       
   179         iEngine->EikonEnv()->SetSystem(ETrue);
       
   180         }
       
   181         
       
   182     TDriveList driveList;
       
   183     err = iFs.DriveList(driveList);
       
   184     
       
   185     if (err == KErrNone)
       
   186         {
       
   187         // deactivate secure backup
       
   188         TRAP(err, iSBEClient->SetBURModeL(driveList, conn::EBURNormal, conn::ENoBackup));
       
   189         
       
   190         User::After(KSecureBackupEndDelay); // a short delay to wait to deactivate
       
   191 
       
   192         // system status not needed anymore
       
   193         iEngine->EikonEnv()->SetSystem(EFalse);
       
   194         }
       
   195     
       
   196     iSecureBackUpActive = EFalse;
       
   197 
       
   198     return err;
       
   199     }
       
   200         
       
   201 // --------------------------------------------------------------------------------------------
       
   202 
       
   203 TInt CFileBrowserFileOps::DoFindEntries(const TDesC& aFileName, const TDesC& aPath)
       
   204     {
       
   205     TFindFile fileFinder(iFs);
       
   206     CDir* dir;
       
   207     TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir);
       
   208 
       
   209     while (err == KErrNone && iFileManObserverResult != MFileManObserver::ECancel)
       
   210         {
       
   211         for (TInt i=0; i<dir->Count(); i++)
       
   212             {
       
   213             TEntry entry = (*dir)[i];
       
   214 
       
   215             if (entry.iName.Length() && aPath.Length())
       
   216                 {
       
   217                 // parse the entry
       
   218                 TParse parsedName;
       
   219                 parsedName.Set(entry.iName, &fileFinder.File(), NULL);
       
   220                 
       
   221                 if (parsedName.Drive().Length() && aPath.Length() && parsedName.Drive()[0] == aPath[0])
       
   222                     {
       
   223                     // get full source path
       
   224                     TFileName fullSourcePath = parsedName.FullName();
       
   225                     if (entry.IsDir())
       
   226                         fullSourcePath.Append(_L("\\"));
       
   227                     
       
   228                     // call the file operation command
       
   229                     switch(iRecursiveState)
       
   230                         {
       
   231                         case EFileOpAttribs:
       
   232                             {
       
   233                             // the same attribs command can be given for both directories and files
       
   234                             FileOpAttribs(fullSourcePath, iUint1, iUint2, iTime1, iUint3);
       
   235                             }
       
   236                             break;
       
   237 
       
   238                         case EFileOpCopy:
       
   239                             {
       
   240                             // calculate length of new entries added to the original source path
       
   241                             TUint newEntriesLength = fullSourcePath.Length() - iBuf1.Length();
       
   242                             
       
   243                             // get pointer description to the rightmost data
       
   244                             TPtr16 newEntriesPtr = fullSourcePath.RightTPtr(newEntriesLength);
       
   245                             
       
   246                             // generate target path
       
   247                             TFileName fullTargetPath = iBuf2;
       
   248                             fullTargetPath.Append(newEntriesPtr);
       
   249                             
       
   250                             if (entry.IsDir())
       
   251                                 {
       
   252                                 // if it is a directory entry, just create it based on the entry's attributes
       
   253                                 FileOpMkDirAll(fullTargetPath, entry.iAtt);
       
   254                                 }
       
   255                             else
       
   256                                 {
       
   257                                 // ensure that root target folder exists
       
   258                                 BaflUtils::EnsurePathExistsL(iFs, iBuf2);
       
   259                                 // otherwise copy the file
       
   260                                 FileOpCopy(fullSourcePath, fullTargetPath, iUint1);
       
   261                                 }
       
   262                             }
       
   263                             break;
       
   264 
       
   265                         case EFileOpDelete:
       
   266                             {
       
   267                             if (entry.IsDir())
       
   268                                 {
       
   269                                 // for directories call rmdir    
       
   270                                 FileOpRmDir(fullSourcePath, iUint1);
       
   271                                 }
       
   272                             else
       
   273                                 {
       
   274                                 // for files call the normal file deletion operation    
       
   275                                 FileOpDeleteFile(fullSourcePath, iUint1);
       
   276                                 }
       
   277                             }
       
   278                             break;
       
   279                                                     
       
   280                         default:
       
   281                             User::Panic (_L("FileOpRecurs"), 775);
       
   282                             break;
       
   283                         }                        
       
   284                     }
       
   285                 }
       
   286                 if ( iFileManObserverResult == MFileManObserver::ECancel ) break;
       
   287             }
       
   288 
       
   289         delete dir;
       
   290         dir = NULL;
       
   291         if ( iFileManObserverResult != MFileManObserver::ECancel )
       
   292             {
       
   293             err = fileFinder.FindWild(dir);
       
   294             }
       
   295         }
       
   296 
       
   297     return err;
       
   298     }
       
   299 
       
   300 // --------------------------------------------------------------------------------------------
       
   301 
       
   302 TInt CFileBrowserFileOps::DoFindEntriesRecursiveL(const TDesC& aFileName, const TDesC& aPath)
       
   303 	{
       
   304     TInt err(KErrNone);
       
   305 
       
   306     // it is logical to scan upwards when deleting and changing attributes
       
   307     CDirScan::TScanDirection scanDirection = CDirScan::EScanUpTree;
       
   308     
       
   309     // when copying files, it is more logical to move downwards
       
   310     if (iRecursiveState == EFileOpCopy)
       
   311         scanDirection = CDirScan::EScanDownTree;
       
   312     
       
   313     
       
   314     CDirScan* scan = CDirScan::NewLC(iFs);
       
   315     scan->SetScanDataL(aPath, KEntryAttDir|KEntryAttMatchMask, ESortByName | EAscending | EDirsFirst, scanDirection);
       
   316     CDir* dir = NULL;
       
   317 
       
   318     for(;;)
       
   319         {
       
   320         TRAP(err, scan->NextL(dir));
       
   321         if (!dir  || (err != KErrNone))
       
   322             break;
       
   323 
       
   324         for (TInt i=0; i<dir->Count(); i++)
       
   325             {
       
   326             TEntry entry = (*dir)[i];
       
   327             
       
   328             if (entry.IsDir())
       
   329                 {
       
   330                 TFileName path(scan->FullPath());
       
   331                 
       
   332                 if (path.Length())
       
   333                     {
       
   334                     path.Append(entry.iName);
       
   335                     path.Append(_L("\\"));
       
   336                     // test path.Left(iBuf2.Length()).Compare(iBuf2) - to prevent never ending recursive copy (in case of copy folder under itself)
       
   337                     if( !(iRecursiveState == EFileOpCopy && !path.Left(iBuf2.Length()).Compare(iBuf2)) )
       
   338                         {
       
   339                         DoFindEntries(aFileName, path);
       
   340                         }
       
   341                     }
       
   342                 }
       
   343             if ( iFileManObserverResult == MFileManObserver::ECancel )
       
   344                 {
       
   345                 break;
       
   346                 }
       
   347             }
       
   348         delete(dir);
       
   349         if ( iFileManObserverResult == MFileManObserver::ECancel )
       
   350             {
       
   351             break;
       
   352             }
       
   353         }
       
   354 
       
   355     CleanupStack::PopAndDestroy(scan);
       
   356     return err;
       
   357     }
       
   358     
       
   359 // --------------------------------------------------------------------------------------------
       
   360 // --------------------------------------------------------------------------------------------
       
   361 
       
   362 TInt CFileBrowserFileOps::Copy(const TFileEntry& aSourceEntry, const TDesC& aTargetFullName, TUint aSwitch, TBool aDeleteSource) 
       
   363     {
       
   364     iOperationError = KErrNone;
       
   365     iFileManObserverResult = MFileManObserver::EContinue;
       
   366     
       
   367     TFileName sourcePath = aSourceEntry.iPath;
       
   368     sourcePath.Append(aSourceEntry.iEntry.iName);
       
   369     
       
   370     TInt err(KErrNone);
       
   371 
       
   372     if (aSourceEntry.iEntry.IsDir() && (aSwitch & CFileMan::ERecurse))
       
   373         {
       
   374         // find all files recursively and run the operation for them
       
   375         iRecursiveState = EFileOpCopy;
       
   376         sourcePath.Append(_L("\\"));
       
   377         
       
   378         TFileName targetPath = aTargetFullName;
       
   379         targetPath.Append(_L("\\"));
       
   380         
       
   381         // remove the recursion flag because we will implement our own recursion
       
   382         TUint newSwitch(aSwitch);
       
   383         newSwitch &= ~CFileMan::ERecurse;
       
   384     
       
   385         iBuf1.Copy(sourcePath);
       
   386         iBuf2.Copy(targetPath);
       
   387         iUint1 = newSwitch;
       
   388         
       
   389         TRAP(err, DoFindEntries(_L("*"), sourcePath));              // entries under current directory entry
       
   390         if ( iFileManObserverResult != MFileManObserver::ECancel )
       
   391             {
       
   392             TRAP(err, DoFindEntriesRecursiveL(_L("*"), sourcePath));    // recursively under directories of current directory entry
       
   393             }
       
   394         // a path has a trailing backslash so it needs to be removed before the call
       
   395         err = FileOpAttribs(targetPath.Left(targetPath.Length()-1), aSourceEntry.iEntry.iAtt, 0, 0, 0);
       
   396         }
       
   397 
       
   398     else if (aSourceEntry.iEntry.IsDir())
       
   399         {
       
   400         TFileName targetPath = aTargetFullName;
       
   401         targetPath.Append(_L("\\"));
       
   402         
       
   403         // just create a directory based on the file attributes of the source directory
       
   404         err = FileOpMkDirAll(targetPath, aSourceEntry.iEntry.iAtt);
       
   405         }
       
   406         
       
   407     else
       
   408         {
       
   409         // remove a recursion flag if present (this should never happen, but some extra error checking)
       
   410         if (aSwitch & CFileMan::ERecurse)
       
   411             aSwitch &= ~CFileMan::ERecurse;    
       
   412             
       
   413         // do the operation for a file entry
       
   414         err = FileOpCopy(sourcePath, aTargetFullName, aSwitch);
       
   415         }
       
   416     
       
   417         
       
   418     // delete source if needed and copy succeeded without any errors (== move operation)
       
   419     if ( aDeleteSource && iOperationError == KErrNone &&
       
   420          iFileManObserverResult != MFileManObserver::ECancel )
       
   421         {
       
   422         err = Delete(aSourceEntry, aSwitch);    
       
   423         }
       
   424     
       
   425     if ( !iOperationError && iFileManObserverResult == MFileManObserver::ECancel )
       
   426         {
       
   427         iOperationError = KErrCancel;
       
   428         }
       
   429         
       
   430     return iOperationError; 
       
   431     }
       
   432 
       
   433 // --------------------------------------------------------------------------------------------
       
   434 
       
   435 TInt CFileBrowserFileOps::FileOpCopy(const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch) 
       
   436     {
       
   437     TInt err = DoFileOpCopy(aSourceFullName, aTargetFullName, aSwitch);
       
   438 
       
   439     // if locked, unlock the file and retry
       
   440     if (iEngine->Settings().iRemoveFileLocks && err == KErrInUse)
       
   441         {
       
   442         // try to remove the file lock by activating secure backup mode
       
   443         if (ActivateSecureBackUpViaFileOp() == KErrNone)
       
   444             {
       
   445             // try the operation several times
       
   446             for (TInt i=0; i<KMaxFileLockAttempts; i++)
       
   447                 {
       
   448                 err = DoFileOpCopy(aSourceFullName, aTargetFullName, aSwitch);
       
   449                 
       
   450                 if (err != KErrInUse)
       
   451                     break;
       
   452                 else
       
   453                     User::After(KSecureBackupLoopDelay);
       
   454                 }
       
   455             }
       
   456         }
       
   457 
       
   458     // if access denied, then try to remove the target path and try again
       
   459     if (iEngine->Settings().iIgnoreProtectionsAtts && err == KErrAccessDenied && BaflUtils::FileExists(iFs, aTargetFullName))
       
   460         {
       
   461         if (FileOpDeleteFile(aTargetFullName, 0) == KErrNone)
       
   462             {
       
   463             err = DoFileOpCopy(aSourceFullName, aTargetFullName, aSwitch);
       
   464             }
       
   465         }
       
   466 
       
   467     // if the file already exists, it is not an error    
       
   468     if (err == KErrAlreadyExists)
       
   469         err = KErrNone;
       
   470     
       
   471     
       
   472     // if copying from a ROM drive, remove the writing protection flag
       
   473     if (iEngine->Settings().iRemoveROMWriteProrection && err == KErrNone && aSourceFullName.Length() > 3 && (aSourceFullName[0]=='z' || aSourceFullName[0]=='Z'))
       
   474         {
       
   475         FileOpAttribs(aTargetFullName, 0, KEntryAttReadOnly, 0, 0);
       
   476         }
       
   477     
       
   478     
       
   479     // remember the "lowest" error
       
   480     if (err < iOperationError)
       
   481         iOperationError = err;
       
   482 
       
   483     LOGSTRING4("FileBrowser: FileOpCopy %S -> %S, err=%d", &aSourceFullName, &aTargetFullName, err);
       
   484         
       
   485     return err; 
       
   486     }
       
   487             
       
   488 // --------------------------------------------------------------------------------------------
       
   489 
       
   490 TInt CFileBrowserFileOps::DoFileOpCopy(const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch) 
       
   491     {
       
   492     #ifndef FILEBROWSER_LITE
       
   493     if (iEngine->Settings().iBypassPlatformSecurity)
       
   494         {
       
   495         if (!iFileOpClient)
       
   496             iFileOpClient = CFBFileOpClient::NewL();   
       
   497             
       
   498         return iFileOpClient->Copy(aSourceFullName, aTargetFullName, aSwitch);
       
   499         }
       
   500     else
       
   501         {
       
   502     #endif
       
   503         //CAsyncWaiter* waiter = CAsyncWaiter::NewLC();
       
   504         //TInt result = iFileMan->Copy( aSourceFullName, aTargetFullName, aSwitch, waiter->iStatus );
       
   505         //waiter->StartAndWait();
       
   506         //if ( !result ) result = waiter->Result();
       
   507         //CleanupStack::PopAndDestroy( waiter );
       
   508         TInt result = iFileMan->Copy( aSourceFullName, aTargetFullName, aSwitch );
       
   509         return result;
       
   510     #ifndef FILEBROWSER_LITE
       
   511         }    
       
   512     #endif
       
   513     }
       
   514 
       
   515 // --------------------------------------------------------------------------------------------
       
   516 // --------------------------------------------------------------------------------------------
       
   517 
       
   518 TInt CFileBrowserFileOps::Rename(const TFileEntry& aSourceEntry, const TDesC& aNew, TUint aSwitch)
       
   519     {
       
   520     iOperationError = KErrNone;
       
   521     iFileManObserverResult = MFileManObserver::EContinue;
       
   522     
       
   523     TFileName sourcePath = aSourceEntry.iPath;
       
   524     sourcePath.Append(aSourceEntry.iEntry.iName);
       
   525     
       
   526     if (aSourceEntry.iEntry.IsDir())
       
   527         {
       
   528         // do the operation for a directory entry
       
   529         FileOpRename(sourcePath, aNew, aSwitch);
       
   530         }
       
   531     else
       
   532         {
       
   533         // do the operation for a file
       
   534         FileOpRename(sourcePath, aNew, aSwitch);
       
   535         }
       
   536 
       
   537     return iOperationError; 
       
   538     }
       
   539 
       
   540 // --------------------------------------------------------------------------------------------
       
   541 
       
   542 TInt CFileBrowserFileOps::FileOpRename(const TDesC& aName, const TDesC& aNew, TUint aSwitch)
       
   543     {
       
   544     TBool setBackROFlag(EFalse);
       
   545 
       
   546     TInt err = DoFileOpRename(aName, aNew, aSwitch);
       
   547 
       
   548     // if locked, unlock the file and retry
       
   549     if (iEngine->Settings().iRemoveFileLocks && err == KErrInUse)
       
   550         {
       
   551         // try to remove the file lock by activating secure backup mode
       
   552         if (ActivateSecureBackUpViaFileOp() == KErrNone)
       
   553             {
       
   554             // try the operation several times
       
   555             for (TInt i=0; i<KMaxFileLockAttempts; i++)
       
   556                 {
       
   557                 err = DoFileOpRename(aName, aNew, aSwitch);
       
   558                 
       
   559                 if (err != KErrInUse)
       
   560                     break;
       
   561                 else
       
   562                     User::After(KSecureBackupLoopDelay);
       
   563                 }
       
   564             }
       
   565         }
       
   566 
       
   567     // if write protected, remove protection and retry
       
   568     else if (iEngine->Settings().iIgnoreProtectionsAtts && err == KErrAccessDenied)
       
   569         {
       
   570         // remove write protection and try again
       
   571         if (FileOpAttribs(aName, 0, KEntryAttReadOnly, 0, 0) == KErrNone)
       
   572             {
       
   573             err = DoFileOpRename(aName, aNew, aSwitch);
       
   574             
       
   575             setBackROFlag = ETrue;
       
   576             }
       
   577         }
       
   578 
       
   579     // if still access denied, then try to remove the target path and try again
       
   580     if (iEngine->Settings().iIgnoreProtectionsAtts && err == KErrAccessDenied && BaflUtils::FileExists(iFs, aNew))
       
   581         {
       
   582         if (FileOpDeleteFile(aNew, 0) == KErrNone)
       
   583             {
       
   584             err = DoFileOpRename(aName, aNew, aSwitch);
       
   585             }
       
   586         }
       
   587 
       
   588     // set back the read only flag
       
   589     if (setBackROFlag)
       
   590         FileOpAttribs(aName, KEntryAttReadOnly, 0, 0, 0);
       
   591             
       
   592 
       
   593     // remember the "lowest" error
       
   594     if (err < iOperationError)
       
   595         iOperationError = err;
       
   596 
       
   597     LOGSTRING3("FileBrowser: FileOpRename %S, err=%d", &aName, err);
       
   598         
       
   599     return err; 
       
   600     }
       
   601     
       
   602 // --------------------------------------------------------------------------------------------
       
   603 
       
   604 TInt CFileBrowserFileOps::DoFileOpRename(const TDesC& aName, const TDesC& aNew, TUint aSwitch)
       
   605     {
       
   606     #ifndef FILEBROWSER_LITE
       
   607     if (iEngine->Settings().iBypassPlatformSecurity)
       
   608         {
       
   609         if (!iFileOpClient)
       
   610             iFileOpClient = CFBFileOpClient::NewL();   
       
   611 
       
   612         return iFileOpClient->Rename(aName, aNew, aSwitch);
       
   613         }
       
   614     else
       
   615         {
       
   616     #endif
       
   617         return iFileMan->Rename(aName, aNew, aSwitch);
       
   618     #ifndef FILEBROWSER_LITE
       
   619         }    
       
   620     #endif
       
   621     }
       
   622 
       
   623 // --------------------------------------------------------------------------------------------
       
   624 // --------------------------------------------------------------------------------------------
       
   625 
       
   626 TInt CFileBrowserFileOps::Attribs(const TFileEntry& aSourceEntry, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch) 
       
   627     {
       
   628     iOperationError = KErrNone;
       
   629     iFileManObserverResult = MFileManObserver::EContinue;
       
   630     
       
   631     TFileName sourcePath = aSourceEntry.iPath;
       
   632     sourcePath.Append(aSourceEntry.iEntry.iName);
       
   633     
       
   634     TInt err(KErrNone);
       
   635 
       
   636     if (aSourceEntry.iEntry.IsDir() && (aSwitch & CFileMan::ERecurse))
       
   637         {
       
   638         // do the operation for a current directory entry
       
   639         err = FileOpAttribs(sourcePath, aSetMask, aClearMask, aTime, 0);
       
   640 
       
   641         // find all files recursively and run the operation for them
       
   642         iRecursiveState = EFileOpAttribs;
       
   643         sourcePath.Append(_L("\\"));
       
   644     
       
   645         iBuf1.Copy(sourcePath);
       
   646         iUint1 = aSetMask;
       
   647         iUint2 = aClearMask;
       
   648         iTime1 = aTime;
       
   649         iUint3 = 0;
       
   650         
       
   651         TRAP(err, DoFindEntriesRecursiveL(_L("*"), sourcePath));    // recursively under directories of current directory entry
       
   652         TRAP(err, DoFindEntries(_L("*"), sourcePath));              // entries under current directory entry
       
   653         }
       
   654 
       
   655     else if (aSourceEntry.iEntry.IsDir())
       
   656         {
       
   657         //sourcePath.Append(_L("\\"));   // <-- do not apply!
       
   658     
       
   659         // do the operation for a directory entry
       
   660         err = FileOpAttribs(sourcePath, aSetMask, aClearMask, aTime, 0);
       
   661         }
       
   662             
       
   663     else
       
   664         {
       
   665         // do the operation for a file entry
       
   666         err = FileOpAttribs(sourcePath, aSetMask, aClearMask, aTime, 0);
       
   667         }
       
   668 
       
   669     return iOperationError;     
       
   670     }
       
   671 
       
   672 // --------------------------------------------------------------------------------------------
       
   673     
       
   674 TInt CFileBrowserFileOps::FileOpAttribs(const TDesC& aName, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch) 
       
   675     {
       
   676     TInt err = DoFileOpAttribs(aName, aSetMask, aClearMask, aTime, aSwitch);
       
   677 
       
   678     // if locked, unlock the file and retry
       
   679     if (iEngine->Settings().iRemoveFileLocks && err == KErrInUse)
       
   680         {
       
   681         // try to remove the file lock by activating secure backup mode
       
   682         if (ActivateSecureBackUpViaFileOp() == KErrNone)
       
   683             {
       
   684             // try the operation several times
       
   685             for (TInt i=0; i<KMaxFileLockAttempts; i++)
       
   686                 {
       
   687                 err = DoFileOpAttribs(aName, aSetMask, aClearMask, aTime, aSwitch);
       
   688                 
       
   689                 if (err != KErrInUse)
       
   690                     break;
       
   691                 else
       
   692                     User::After(KSecureBackupLoopDelay);
       
   693                 }
       
   694             }
       
   695         }
       
   696 
       
   697     // remember the "lowest" error
       
   698     if (err < iOperationError)
       
   699         iOperationError = err;
       
   700 
       
   701     LOGSTRING3("FileBrowser: FileOpAttribs %S, err=%d", &aName, err);
       
   702         
       
   703     return err;    
       
   704     }
       
   705     
       
   706 // --------------------------------------------------------------------------------------------
       
   707     
       
   708 TInt CFileBrowserFileOps::DoFileOpAttribs(const TDesC& aName, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch) 
       
   709     {
       
   710     #ifndef FILEBROWSER_LITE
       
   711     if (iEngine->Settings().iBypassPlatformSecurity)
       
   712         {
       
   713         if (!iFileOpClient)
       
   714             iFileOpClient = CFBFileOpClient::NewL();   
       
   715 
       
   716         return iFileOpClient->Attribs(aName, aSetMask, aClearMask, aTime, aSwitch);
       
   717         }
       
   718     else
       
   719         {
       
   720     #endif
       
   721         return iFileMan->Attribs(aName, aSetMask, aClearMask, aTime, aSwitch);
       
   722     #ifndef FILEBROWSER_LITE
       
   723         }    
       
   724     #endif
       
   725     }
       
   726 
       
   727 // --------------------------------------------------------------------------------------------
       
   728 // --------------------------------------------------------------------------------------------
       
   729 
       
   730 TInt CFileBrowserFileOps::Delete(const TFileEntry& aSourceEntry, TUint aSwitch) 
       
   731     {
       
   732     iOperationError = KErrNone;
       
   733     iFileManObserverResult = MFileManObserver::EContinue;
       
   734     
       
   735     TFileName sourcePath = aSourceEntry.iPath;
       
   736     sourcePath.Append(aSourceEntry.iEntry.iName);
       
   737     
       
   738     TInt err(KErrNone);
       
   739 
       
   740     if (aSourceEntry.iEntry.IsDir() && (aSwitch & CFileMan::ERecurse))
       
   741         {
       
   742         // find all files recursively and run the operation for them
       
   743         iRecursiveState = EFileOpDelete;
       
   744         sourcePath.Append(_L("\\"));
       
   745     
       
   746         iBuf1.Copy(sourcePath);
       
   747         iUint1 = 0;
       
   748         
       
   749         TRAP(err, DoFindEntriesRecursiveL(_L("*"), sourcePath));    // recursively under directories of current directory entry
       
   750         if ( iFileManObserverResult != MFileManObserver::ECancel )
       
   751             {
       
   752             TRAP(err, DoFindEntries(_L("*"), sourcePath));              // entries under current directory entry
       
   753             }
       
   754         
       
   755         if ( iFileManObserverResult != MFileManObserver::ECancel )
       
   756             {
       
   757             // do the operation for a current directory entry as well
       
   758             err = FileOpRmDir(sourcePath, 0);
       
   759             }
       
   760         }
       
   761 
       
   762     else if (aSourceEntry.iEntry.IsDir())
       
   763         {
       
   764         sourcePath.Append(_L("\\"));
       
   765     
       
   766         // do the operation for a directory entry
       
   767         err = FileOpRmDir(sourcePath, 0);
       
   768         }
       
   769 
       
   770     else
       
   771         {
       
   772         // do the operation for a file entry
       
   773         err = FileOpDeleteFile(sourcePath, 0);
       
   774         }
       
   775     if ( !iOperationError && iFileManObserverResult == MFileManObserver::ECancel )
       
   776         {
       
   777         iOperationError = KErrCancel;
       
   778         }
       
   779     return iOperationError; 
       
   780     }
       
   781 
       
   782 // --------------------------------------------------------------------------------------------
       
   783 
       
   784 TInt CFileBrowserFileOps::FileOpDeleteFile(const TDesC& aName, TUint aSwitch) 
       
   785     {
       
   786     TInt err = DoFileOpDeleteFile(aName, aSwitch);
       
   787 
       
   788     // if locked, unlock the file and retry
       
   789     if (iEngine->Settings().iRemoveFileLocks && err == KErrInUse)
       
   790         {
       
   791         // try to remove the file lock by activating secure backup mode
       
   792         if (ActivateSecureBackUpViaFileOp() == KErrNone)
       
   793             {
       
   794             // try the operation several times
       
   795             for (TInt i=0; i<KMaxFileLockAttempts; i++)
       
   796                 {
       
   797                 err = DoFileOpDeleteFile(aName, aSwitch);
       
   798                 
       
   799                 if (err != KErrInUse)
       
   800                     break;
       
   801                 else
       
   802                     User::After(KSecureBackupLoopDelay);
       
   803                 }
       
   804             }
       
   805         }
       
   806 
       
   807     // if write protected or system file, remove protections and retry
       
   808     else if (iEngine->Settings().iIgnoreProtectionsAtts && (err == KErrAccessDenied || err == KErrNotFound))
       
   809         {
       
   810         // remove protections  and try again
       
   811         if (FileOpAttribs(aName, 0, KEntryAttReadOnly|KEntryAttSystem|KEntryAttHidden, 0, 0) == KErrNone)
       
   812             {
       
   813             err = DoFileOpDeleteFile(aName, aSwitch);
       
   814             }
       
   815         }
       
   816 
       
   817     // remember the "lowest" error
       
   818     if (err < iOperationError)
       
   819         iOperationError = err;
       
   820 
       
   821     LOGSTRING3("FileBrowser: FileOpDeleteFile %S, err=%d", &aName, err);
       
   822         
       
   823     return err; 
       
   824     }
       
   825         
       
   826 // --------------------------------------------------------------------------------------------
       
   827 
       
   828 TInt CFileBrowserFileOps::DoFileOpDeleteFile(const TDesC& aName, TUint aSwitch) 
       
   829     {
       
   830     #ifndef FILEBROWSER_LITE
       
   831     if (iEngine->Settings().iBypassPlatformSecurity)
       
   832         {
       
   833         if (!iFileOpClient)
       
   834             iFileOpClient = CFBFileOpClient::NewL();   
       
   835 
       
   836         return iFileOpClient->Delete(aName, aSwitch);
       
   837         }
       
   838     else
       
   839         {
       
   840     #endif
       
   841 //        CAsyncWaiter* waiter = CAsyncWaiter::NewLC();
       
   842 //        TInt result = iFileMan->Delete( aName, aSwitch, waiter->iStatus );
       
   843 //        waiter->StartAndWait();
       
   844 //        if ( iFileManObserverResult == MFileManObserver::ECancel ) result = KErrCancel;
       
   845 //        if ( !result ) result = waiter->Result();
       
   846 //        CleanupStack::PopAndDestroy( waiter );
       
   847 		TInt result = iFileMan->Delete( aName, aSwitch );
       
   848         return result;
       
   849     #ifndef FILEBROWSER_LITE
       
   850         }    
       
   851     #endif
       
   852     }
       
   853 
       
   854 // --------------------------------------------------------------------------------------------
       
   855 
       
   856 TInt CFileBrowserFileOps::FileOpRmDir(const TDesC& aName, TUint aSwitch) 
       
   857     {
       
   858     TInt err = DoFileOpRmDir(aName, aSwitch);
       
   859 
       
   860     // if write protected or system directory, remove protections and retry
       
   861     if (iEngine->Settings().iIgnoreProtectionsAtts && (err == KErrAccessDenied || err == KErrInUse))
       
   862         {
       
   863         // remove protections and try again
       
   864         if (FileOpAttribs(aName.Left(aName.Length()-1), 0, KEntryAttReadOnly|KEntryAttSystem|KEntryAttHidden, 0, 0) == KErrNone)
       
   865             {
       
   866             err = DoFileOpRmDir(aName, aSwitch);
       
   867             }
       
   868         }
       
   869 
       
   870     // remember the "lowest" error
       
   871     if (err < iOperationError)
       
   872         iOperationError = err;
       
   873 
       
   874     LOGSTRING3("FileBrowser: FileOpRmDir %S, err=%d", &aName, err);
       
   875         
       
   876     return err; 
       
   877     }
       
   878         
       
   879 // --------------------------------------------------------------------------------------------
       
   880 
       
   881 TInt CFileBrowserFileOps::DoFileOpRmDir(const TDesC& aDirName, TUint aSwitch)
       
   882     {
       
   883     #ifndef FILEBROWSER_LITE
       
   884     if (iEngine->Settings().iBypassPlatformSecurity)
       
   885         {
       
   886         if (!iFileOpClient)
       
   887             iFileOpClient = CFBFileOpClient::NewL();   
       
   888 
       
   889         return iFileOpClient->RmDir(aDirName, aSwitch);
       
   890         }
       
   891     else
       
   892         {
       
   893     #endif
       
   894         if ( aSwitch & CFileMan::ERecurse )
       
   895             {
       
   896 //            CAsyncWaiter* waiter = CAsyncWaiter::NewLC();
       
   897 //            TInt result = iFileMan->RmDir( aDirName, waiter->iStatus );
       
   898 //            waiter->StartAndWait();
       
   899 //            if ( iFileManObserverResult == MFileManObserver::ECancel ) result = KErrCancel;
       
   900 //            if ( !result ) result = waiter->Result();
       
   901 //            CleanupStack::PopAndDestroy( waiter);
       
   902             TInt result = iFileMan->RmDir( aDirName );
       
   903             return result;
       
   904             }
       
   905         else
       
   906             return iFs.RmDir(aDirName);    
       
   907     #ifndef FILEBROWSER_LITE
       
   908         }    
       
   909     #endif
       
   910    }
       
   911 
       
   912 // --------------------------------------------------------------------------------------------
       
   913 // --------------------------------------------------------------------------------------------
       
   914 
       
   915 TInt CFileBrowserFileOps::MkDirAll(const TDesC& aPath, TInt aSetAtts, TBool aQuickOperation) 
       
   916     {
       
   917     iFileManObserverResult = MFileManObserver::EContinue;
       
   918     if (aQuickOperation)
       
   919         return DoFileOpMkDirAll(aPath);
       
   920     else
       
   921         return FileOpMkDirAll(aPath, aSetAtts);
       
   922     }
       
   923 
       
   924 // --------------------------------------------------------------------------------------------
       
   925 
       
   926 TInt CFileBrowserFileOps::FileOpMkDirAll(const TDesC& aPath, TInt aSetAtts) 
       
   927     {
       
   928     TInt err = DoFileOpMkDirAll(aPath);
       
   929 
       
   930     // if the directory already exists, it is not an error    
       
   931     if (err == KErrAlreadyExists)
       
   932         err = KErrNone;
       
   933     
       
   934     
       
   935     // set attributes for directory just created
       
   936     if (aSetAtts > 0 && err == KErrNone && aPath.Length() > 3)
       
   937         {
       
   938         // a path has a trailing backslash so it needs to be removed before the call
       
   939         err = FileOpAttribs(aPath.Left(aPath.Length()-1), aSetAtts, 0, 0, 0);
       
   940         }
       
   941     
       
   942 
       
   943     // remember the "lowest" error
       
   944     if (err < iOperationError)
       
   945         iOperationError = err;
       
   946     
       
   947     LOGSTRING3("FileBrowser: FileOpMkDirAll %S, err=%d", &aPath, err);
       
   948     
       
   949     return err;
       
   950     }
       
   951         
       
   952 // --------------------------------------------------------------------------------------------
       
   953 
       
   954 TInt CFileBrowserFileOps::DoFileOpMkDirAll(const TDesC& aPath) 
       
   955     {
       
   956     #ifndef FILEBROWSER_LITE
       
   957     if (iEngine->Settings().iBypassPlatformSecurity)
       
   958         {
       
   959         if (!iFileOpClient)
       
   960             iFileOpClient = CFBFileOpClient::NewL();   
       
   961 
       
   962         return iFileOpClient->MkDirAll(aPath);
       
   963         }
       
   964     else
       
   965         {
       
   966     #endif
       
   967         return iFs.MkDirAll(aPath);
       
   968     #ifndef FILEBROWSER_LITE
       
   969         }    
       
   970     #endif
       
   971     }
       
   972 
       
   973 // --------------------------------------------------------------------------------------------
       
   974 // --------------------------------------------------------------------------------------------
       
   975 
       
   976 TInt CFileBrowserFileOps::CreateEmptyFile(const TDesC& aName) 
       
   977     {
       
   978     return DoFileOpCreateEmptyFile(aName);
       
   979     }
       
   980 
       
   981 // --------------------------------------------------------------------------------------------
       
   982 
       
   983 TInt CFileBrowserFileOps::FileOpCreateEmptyFile(const TDesC& aName) 
       
   984     {
       
   985     TInt err = DoFileOpCreateEmptyFile(aName);
       
   986 
       
   987     // remember the "lowest" error
       
   988     if (err < iOperationError)
       
   989         iOperationError = err;
       
   990     
       
   991     LOGSTRING3("FileBrowser: FileOpCreateEmptyFile %S, err=%d", &aName, err);
       
   992     
       
   993     return err;
       
   994     }
       
   995 
       
   996 // --------------------------------------------------------------------------------------------
       
   997     
       
   998 TInt CFileBrowserFileOps::DoFileOpCreateEmptyFile(const TDesC& aName) 
       
   999     {
       
  1000     #ifndef FILEBROWSER_LITE
       
  1001     if (iEngine->Settings().iBypassPlatformSecurity)
       
  1002         {
       
  1003         if (!iFileOpClient)
       
  1004             iFileOpClient = CFBFileOpClient::NewL();   
       
  1005 
       
  1006         return iFileOpClient->CreateEmptyFile(aName);
       
  1007         }
       
  1008     else
       
  1009         {
       
  1010     #endif
       
  1011         TInt err(KErrNone);
       
  1012             
       
  1013         RFile newFile;
       
  1014         err = newFile.Create(iFs, aName, EFileShareExclusive);
       
  1015         if (err == KErrNone)
       
  1016             err = newFile.Flush(); 
       
  1017         newFile.Close();
       
  1018         
       
  1019         return err; 
       
  1020     #ifndef FILEBROWSER_LITE
       
  1021         }    
       
  1022     #endif
       
  1023     }
       
  1024 
       
  1025 // --------------------------------------------------------------------------------------------
       
  1026 
       
  1027 TInt CFileBrowserFileOps::DriveSnapShot(TChar aSourceDriveLetter, TChar aTargetDriveLetter)
       
  1028     {
       
  1029     TInt err(KErrNone);
       
  1030     iFileManObserverResult = MFileManObserver::EContinue;
       
  1031     
       
  1032     // remember old settings and force them to be true for this operation
       
  1033     TBool currentRemoveFileLocksValue = iEngine->Settings().iRemoveFileLocks;
       
  1034     TBool currentIgnoreProtectionAttsValue = iEngine->Settings().iIgnoreProtectionsAtts;
       
  1035     TBool currentRemoveROMWriteProrection = iEngine->Settings().iRemoveROMWriteProrection;
       
  1036     iEngine->Settings().iRemoveFileLocks = ETrue;
       
  1037     iEngine->Settings().iIgnoreProtectionsAtts = ETrue;
       
  1038     iEngine->Settings().iRemoveROMWriteProrection = ETrue;
       
  1039 
       
  1040     
       
  1041     TFileName sourceDir;
       
  1042     sourceDir.Append(aSourceDriveLetter);
       
  1043     sourceDir.Append(_L(":"));
       
  1044 
       
  1045     _LIT(KTargetDir, "%c:\\SnapShot_%c_drive");
       
  1046     TFileName targetDir;
       
  1047     targetDir.Format(KTargetDir, TUint(aTargetDriveLetter), TUint(aSourceDriveLetter));            
       
  1048 
       
  1049     // remove any existing content, first get TEntry
       
  1050     TEntry entry;
       
  1051     err = iFs.Entry(targetDir, entry);
       
  1052 
       
  1053     // entry directory exists, delete it
       
  1054     if (err == KErrNone && entry.IsDir())
       
  1055         {
       
  1056         TFileName targetRoot;
       
  1057         targetRoot.Append(aTargetDriveLetter);
       
  1058         targetRoot.Append(_L(":\\"));
       
  1059 
       
  1060         TFileEntry targetEntry;
       
  1061         targetEntry.iPath = targetRoot;
       
  1062         targetEntry.iEntry = entry;
       
  1063 
       
  1064         err = Delete(targetEntry, CFileMan::ERecurse);                
       
  1065         }
       
  1066         
       
  1067     // do not care if removing succeeded or not, just continue with copying    
       
  1068     TEntry fakeEntry;
       
  1069     fakeEntry.iAtt |= KEntryAttDir;
       
  1070 
       
  1071     TFileEntry sourceEntry;
       
  1072     sourceEntry.iPath = sourceDir;
       
  1073     sourceEntry.iEntry = fakeEntry;
       
  1074 
       
  1075     err = Copy(sourceEntry, targetDir, CFileMan::ERecurse|CFileMan::EOverWrite);                
       
  1076 
       
  1077 
       
  1078     // restore back settings
       
  1079     iEngine->Settings().iRemoveFileLocks = currentRemoveFileLocksValue;
       
  1080     iEngine->Settings().iIgnoreProtectionsAtts = currentIgnoreProtectionAttsValue;    
       
  1081     iEngine->Settings().iRemoveROMWriteProrection = currentRemoveROMWriteProrection;    
       
  1082 
       
  1083 
       
  1084     return iOperationError;
       
  1085     }
       
  1086 
       
  1087 // --------------------------------------------------------------------------------------------
       
  1088 
       
  1089 TInt CFileBrowserFileOps::EraseMBR(TUint aDriveNumber) 
       
  1090     {
       
  1091     #ifndef FILEBROWSER_LITE
       
  1092 
       
  1093         if (!iFileOpClient)
       
  1094             iFileOpClient = CFBFileOpClient::NewL();
       
  1095         
       
  1096         return iFileOpClient->EraseMBR(aDriveNumber);
       
  1097 
       
  1098     #else
       
  1099         return KErrNotSupported;
       
  1100     #endif
       
  1101     }
       
  1102 
       
  1103 // --------------------------------------------------------------------------------------------
       
  1104 
       
  1105 TInt CFileBrowserFileOps::PartitionDrive(TUint aDriveNumber, TUint aNumberOfPartitions) 
       
  1106     {
       
  1107     #ifndef FILEBROWSER_LITE
       
  1108 
       
  1109         if (!iFileOpClient)
       
  1110             iFileOpClient = CFBFileOpClient::NewL();
       
  1111         
       
  1112         return iFileOpClient->PartitionDrive(aDriveNumber, aNumberOfPartitions);
       
  1113 
       
  1114     #else
       
  1115         return KErrNotSupported
       
  1116     #endif
       
  1117     }
       
  1118 
       
  1119 // --------------------------------------------------------------------------------------------
       
  1120 
       
  1121 MFileManObserver::TControl CFileBrowserFileOps::NotifyFileManStarted()
       
  1122     {
       
  1123     return iFileManObserverResult;
       
  1124     }
       
  1125 
       
  1126 // --------------------------------------------------------------------------------------------
       
  1127 
       
  1128 MFileManObserver::TControl CFileBrowserFileOps::NotifyFileManOperation()
       
  1129     {
       
  1130     return iFileManObserverResult;
       
  1131     }
       
  1132 // --------------------------------------------------------------------------------------------
       
  1133 
       
  1134 MFileManObserver::TControl CFileBrowserFileOps::NotifyFileManEnded()
       
  1135     {
       
  1136     return iFileManObserverResult;
       
  1137     }
       
  1138 
       
  1139 // --------------------------------------------------------------------------------------------
       
  1140 
       
  1141 void CFileBrowserFileOps::CancelOp()
       
  1142     {
       
  1143 #ifndef FILEBROWSER_LITE
       
  1144 
       
  1145     if ( iEngine->Settings().iBypassPlatformSecurity )
       
  1146         {
       
  1147         if ( !iFileOpClient )
       
  1148             iFileOpClient = CFBFileOpClient::NewL();
       
  1149         
       
  1150         iFileOpClient->CancelOp();
       
  1151         }
       
  1152 
       
  1153     // we need this information even when using iFileOpClient
       
  1154     // to be able to not execute aggregate operations 
       
  1155     iFileManObserverResult = MFileManObserver::ECancel;
       
  1156     
       
  1157 #else
       
  1158     iFileManObserverResult = MFileManObserver::ECancel;
       
  1159 #endif
       
  1160     }
       
  1161 
       
  1162 // End of File