filebrowser/engine/FBFileOps.cpp
changeset 55 2d9cac8919d3
parent 53 819e59dfc032
child 56 392f7045e621
equal deleted inserted replaced
53:819e59dfc032 55:2d9cac8919d3
     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         // ensure that target folder exists in case of copying empty folder
       
   395         BaflUtils::EnsurePathExistsL(iFs, targetPath);
       
   396         // a path has a trailing backslash so it needs to be removed before the call
       
   397         err = FileOpAttribs(targetPath.Left(targetPath.Length()-1), aSourceEntry.iEntry.iAtt, 0, 0, 0);
       
   398         }
       
   399 
       
   400     else if (aSourceEntry.iEntry.IsDir())
       
   401         {
       
   402         TFileName targetPath = aTargetFullName;
       
   403         targetPath.Append(_L("\\"));
       
   404         
       
   405         // just create a directory based on the file attributes of the source directory
       
   406         err = FileOpMkDirAll(targetPath, aSourceEntry.iEntry.iAtt);
       
   407         }
       
   408         
       
   409     else
       
   410         {
       
   411         // remove a recursion flag if present (this should never happen, but some extra error checking)
       
   412         if (aSwitch & CFileMan::ERecurse)
       
   413             aSwitch &= ~CFileMan::ERecurse;    
       
   414             
       
   415         // do the operation for a file entry
       
   416         err = FileOpCopy(sourcePath, aTargetFullName, aSwitch);
       
   417         }
       
   418     
       
   419         
       
   420     // delete source if needed and copy succeeded without any errors (== move operation)
       
   421     if ( aDeleteSource && iOperationError == KErrNone &&
       
   422          iFileManObserverResult != MFileManObserver::ECancel )
       
   423         {
       
   424         err = Delete(aSourceEntry, aSwitch);    
       
   425         }
       
   426     
       
   427     if ( !iOperationError && iFileManObserverResult == MFileManObserver::ECancel )
       
   428         {
       
   429         iOperationError = KErrCancel;
       
   430         }
       
   431         
       
   432     return iOperationError; 
       
   433     }
       
   434 
       
   435 // --------------------------------------------------------------------------------------------
       
   436 
       
   437 TInt CFileBrowserFileOps::FileOpCopy(const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch) 
       
   438     {
       
   439     TInt err = DoFileOpCopy(aSourceFullName, aTargetFullName, aSwitch);
       
   440 
       
   441     // if locked, unlock the file and retry
       
   442     if (iEngine->Settings().iRemoveFileLocks && err == KErrInUse)
       
   443         {
       
   444         // try to remove the file lock by activating secure backup mode
       
   445         if (ActivateSecureBackUpViaFileOp() == KErrNone)
       
   446             {
       
   447             // try the operation several times
       
   448             for (TInt i=0; i<KMaxFileLockAttempts; i++)
       
   449                 {
       
   450                 err = DoFileOpCopy(aSourceFullName, aTargetFullName, aSwitch);
       
   451                 
       
   452                 if (err != KErrInUse)
       
   453                     break;
       
   454                 else
       
   455                     User::After(KSecureBackupLoopDelay);
       
   456                 }
       
   457             }
       
   458         }
       
   459 
       
   460     // if access denied, then try to remove the target path and try again
       
   461     if (iEngine->Settings().iIgnoreProtectionsAtts && err == KErrAccessDenied && BaflUtils::FileExists(iFs, aTargetFullName))
       
   462         {
       
   463         if (FileOpDeleteFile(aTargetFullName, 0) == KErrNone)
       
   464             {
       
   465             err = DoFileOpCopy(aSourceFullName, aTargetFullName, aSwitch);
       
   466             }
       
   467         }
       
   468 
       
   469     // if the file already exists, it is not an error    
       
   470     if (err == KErrAlreadyExists)
       
   471         err = KErrNone;
       
   472     
       
   473     
       
   474     // if copying from a ROM drive, remove the writing protection flag
       
   475     if (iEngine->Settings().iRemoveROMWriteProrection && err == KErrNone && aSourceFullName.Length() > 3 && (aSourceFullName[0]=='z' || aSourceFullName[0]=='Z'))
       
   476         {
       
   477         FileOpAttribs(aTargetFullName, 0, KEntryAttReadOnly, 0, 0);
       
   478         }
       
   479     
       
   480     
       
   481     // remember the "lowest" error
       
   482     if (err < iOperationError)
       
   483         iOperationError = err;
       
   484 
       
   485     LOGSTRING4("FileBrowser: FileOpCopy %S -> %S, err=%d", &aSourceFullName, &aTargetFullName, err);
       
   486         
       
   487     return err; 
       
   488     }
       
   489             
       
   490 // --------------------------------------------------------------------------------------------
       
   491 
       
   492 TInt CFileBrowserFileOps::DoFileOpCopy(const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch) 
       
   493     {
       
   494     #ifndef FILEBROWSER_LITE
       
   495     if (iEngine->Settings().iBypassPlatformSecurity)
       
   496         {
       
   497         if (!iFileOpClient)
       
   498             iFileOpClient = CFBFileOpClient::NewL();   
       
   499             
       
   500         return iFileOpClient->Copy(aSourceFullName, aTargetFullName, aSwitch);
       
   501         }
       
   502     else
       
   503         {
       
   504     #endif
       
   505         //CAsyncWaiter* waiter = CAsyncWaiter::NewLC();
       
   506         //TInt result = iFileMan->Copy( aSourceFullName, aTargetFullName, aSwitch, waiter->iStatus );
       
   507         //waiter->StartAndWait();
       
   508         //if ( !result ) result = waiter->Result();
       
   509         //CleanupStack::PopAndDestroy( waiter );
       
   510         TInt result = iFileMan->Copy( aSourceFullName, aTargetFullName, aSwitch );
       
   511         return result;
       
   512     #ifndef FILEBROWSER_LITE
       
   513         }    
       
   514     #endif
       
   515     }
       
   516 
       
   517 // --------------------------------------------------------------------------------------------
       
   518 // --------------------------------------------------------------------------------------------
       
   519 
       
   520 TInt CFileBrowserFileOps::Rename(const TFileEntry& aSourceEntry, const TDesC& aNew, TUint aSwitch)
       
   521     {
       
   522     iOperationError = KErrNone;
       
   523     iFileManObserverResult = MFileManObserver::EContinue;
       
   524     
       
   525     TFileName sourcePath = aSourceEntry.iPath;
       
   526     sourcePath.Append(aSourceEntry.iEntry.iName);
       
   527     
       
   528     if (aSourceEntry.iEntry.IsDir())
       
   529         {
       
   530         // do the operation for a directory entry
       
   531         FileOpRename(sourcePath, aNew, aSwitch);
       
   532         }
       
   533     else
       
   534         {
       
   535         // do the operation for a file
       
   536         FileOpRename(sourcePath, aNew, aSwitch);
       
   537         }
       
   538 
       
   539     return iOperationError; 
       
   540     }
       
   541 
       
   542 // --------------------------------------------------------------------------------------------
       
   543 
       
   544 TInt CFileBrowserFileOps::FileOpRename(const TDesC& aName, const TDesC& aNew, TUint aSwitch)
       
   545     {
       
   546     TBool setBackROFlag(EFalse);
       
   547 
       
   548     TInt err = DoFileOpRename(aName, aNew, aSwitch);
       
   549 
       
   550     // if locked, unlock the file and retry
       
   551     if (iEngine->Settings().iRemoveFileLocks && err == KErrInUse)
       
   552         {
       
   553         // try to remove the file lock by activating secure backup mode
       
   554         if (ActivateSecureBackUpViaFileOp() == KErrNone)
       
   555             {
       
   556             // try the operation several times
       
   557             for (TInt i=0; i<KMaxFileLockAttempts; i++)
       
   558                 {
       
   559                 err = DoFileOpRename(aName, aNew, aSwitch);
       
   560                 
       
   561                 if (err != KErrInUse)
       
   562                     break;
       
   563                 else
       
   564                     User::After(KSecureBackupLoopDelay);
       
   565                 }
       
   566             }
       
   567         }
       
   568 
       
   569     // if write protected, remove protection and retry
       
   570     else if (iEngine->Settings().iIgnoreProtectionsAtts && err == KErrAccessDenied)
       
   571         {
       
   572         // remove write protection and try again
       
   573         if (FileOpAttribs(aName, 0, KEntryAttReadOnly, 0, 0) == KErrNone)
       
   574             {
       
   575             err = DoFileOpRename(aName, aNew, aSwitch);
       
   576             
       
   577             setBackROFlag = ETrue;
       
   578             }
       
   579         }
       
   580 
       
   581     // if still access denied, then try to remove the target path and try again
       
   582     if (iEngine->Settings().iIgnoreProtectionsAtts && err == KErrAccessDenied && BaflUtils::FileExists(iFs, aNew))
       
   583         {
       
   584         if (FileOpDeleteFile(aNew, 0) == KErrNone)
       
   585             {
       
   586             err = DoFileOpRename(aName, aNew, aSwitch);
       
   587             }
       
   588         }
       
   589 
       
   590     // set back the read only flag
       
   591     if (setBackROFlag)
       
   592         FileOpAttribs(aName, KEntryAttReadOnly, 0, 0, 0);
       
   593             
       
   594 
       
   595     // remember the "lowest" error
       
   596     if (err < iOperationError)
       
   597         iOperationError = err;
       
   598 
       
   599     LOGSTRING3("FileBrowser: FileOpRename %S, err=%d", &aName, err);
       
   600         
       
   601     return err; 
       
   602     }
       
   603     
       
   604 // --------------------------------------------------------------------------------------------
       
   605 
       
   606 TInt CFileBrowserFileOps::DoFileOpRename(const TDesC& aName, const TDesC& aNew, TUint aSwitch)
       
   607     {
       
   608     #ifndef FILEBROWSER_LITE
       
   609     if (iEngine->Settings().iBypassPlatformSecurity)
       
   610         {
       
   611         if (!iFileOpClient)
       
   612             iFileOpClient = CFBFileOpClient::NewL();   
       
   613 
       
   614         return iFileOpClient->Rename(aName, aNew, aSwitch);
       
   615         }
       
   616     else
       
   617         {
       
   618     #endif
       
   619         return iFileMan->Rename(aName, aNew, aSwitch);
       
   620     #ifndef FILEBROWSER_LITE
       
   621         }    
       
   622     #endif
       
   623     }
       
   624 
       
   625 // --------------------------------------------------------------------------------------------
       
   626 // --------------------------------------------------------------------------------------------
       
   627 
       
   628 TInt CFileBrowserFileOps::Attribs(const TFileEntry& aSourceEntry, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch) 
       
   629     {
       
   630     iOperationError = KErrNone;
       
   631     iFileManObserverResult = MFileManObserver::EContinue;
       
   632     
       
   633     TFileName sourcePath = aSourceEntry.iPath;
       
   634     sourcePath.Append(aSourceEntry.iEntry.iName);
       
   635     
       
   636     TInt err(KErrNone);
       
   637 
       
   638     if (aSourceEntry.iEntry.IsDir() && (aSwitch & CFileMan::ERecurse))
       
   639         {
       
   640         // do the operation for a current directory entry
       
   641         err = FileOpAttribs(sourcePath, aSetMask, aClearMask, aTime, 0);
       
   642 
       
   643         // find all files recursively and run the operation for them
       
   644         iRecursiveState = EFileOpAttribs;
       
   645         sourcePath.Append(_L("\\"));
       
   646     
       
   647         iBuf1.Copy(sourcePath);
       
   648         iUint1 = aSetMask;
       
   649         iUint2 = aClearMask;
       
   650         iTime1 = aTime;
       
   651         iUint3 = 0;
       
   652         
       
   653         TRAP(err, DoFindEntriesRecursiveL(_L("*"), sourcePath));    // recursively under directories of current directory entry
       
   654         TRAP(err, DoFindEntries(_L("*"), sourcePath));              // entries under current directory entry
       
   655         }
       
   656 
       
   657     else if (aSourceEntry.iEntry.IsDir())
       
   658         {
       
   659         //sourcePath.Append(_L("\\"));   // <-- do not apply!
       
   660     
       
   661         // do the operation for a directory entry
       
   662         err = FileOpAttribs(sourcePath, aSetMask, aClearMask, aTime, 0);
       
   663         }
       
   664             
       
   665     else
       
   666         {
       
   667         // do the operation for a file entry
       
   668         err = FileOpAttribs(sourcePath, aSetMask, aClearMask, aTime, 0);
       
   669         }
       
   670 
       
   671     return iOperationError;     
       
   672     }
       
   673 
       
   674 // --------------------------------------------------------------------------------------------
       
   675     
       
   676 TInt CFileBrowserFileOps::FileOpAttribs(const TDesC& aName, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch) 
       
   677     {
       
   678     TInt err = DoFileOpAttribs(aName, aSetMask, aClearMask, aTime, aSwitch);
       
   679 
       
   680     // if locked, unlock the file and retry
       
   681     if (iEngine->Settings().iRemoveFileLocks && err == KErrInUse)
       
   682         {
       
   683         // try to remove the file lock by activating secure backup mode
       
   684         if (ActivateSecureBackUpViaFileOp() == KErrNone)
       
   685             {
       
   686             // try the operation several times
       
   687             for (TInt i=0; i<KMaxFileLockAttempts; i++)
       
   688                 {
       
   689                 err = DoFileOpAttribs(aName, aSetMask, aClearMask, aTime, aSwitch);
       
   690                 
       
   691                 if (err != KErrInUse)
       
   692                     break;
       
   693                 else
       
   694                     User::After(KSecureBackupLoopDelay);
       
   695                 }
       
   696             }
       
   697         }
       
   698 
       
   699     // remember the "lowest" error
       
   700     if (err < iOperationError)
       
   701         iOperationError = err;
       
   702 
       
   703     LOGSTRING3("FileBrowser: FileOpAttribs %S, err=%d", &aName, err);
       
   704         
       
   705     return err;    
       
   706     }
       
   707     
       
   708 // --------------------------------------------------------------------------------------------
       
   709     
       
   710 TInt CFileBrowserFileOps::DoFileOpAttribs(const TDesC& aName, TUint aSetMask, TUint aClearMask, const TTime& aTime, TUint aSwitch) 
       
   711     {
       
   712     #ifndef FILEBROWSER_LITE
       
   713     if (iEngine->Settings().iBypassPlatformSecurity)
       
   714         {
       
   715         if (!iFileOpClient)
       
   716             iFileOpClient = CFBFileOpClient::NewL();   
       
   717 
       
   718         return iFileOpClient->Attribs(aName, aSetMask, aClearMask, aTime, aSwitch);
       
   719         }
       
   720     else
       
   721         {
       
   722     #endif
       
   723         return iFileMan->Attribs(aName, aSetMask, aClearMask, aTime, aSwitch);
       
   724     #ifndef FILEBROWSER_LITE
       
   725         }    
       
   726     #endif
       
   727     }
       
   728 
       
   729 // --------------------------------------------------------------------------------------------
       
   730 // --------------------------------------------------------------------------------------------
       
   731 
       
   732 TInt CFileBrowserFileOps::Delete(const TFileEntry& aSourceEntry, TUint aSwitch) 
       
   733     {
       
   734     iOperationError = KErrNone;
       
   735     iFileManObserverResult = MFileManObserver::EContinue;
       
   736     
       
   737     TFileName sourcePath = aSourceEntry.iPath;
       
   738     sourcePath.Append(aSourceEntry.iEntry.iName);
       
   739     
       
   740     TInt err(KErrNone);
       
   741 
       
   742     if (aSourceEntry.iEntry.IsDir() && (aSwitch & CFileMan::ERecurse))
       
   743         {
       
   744         // find all files recursively and run the operation for them
       
   745         iRecursiveState = EFileOpDelete;
       
   746         sourcePath.Append(_L("\\"));
       
   747     
       
   748         iBuf1.Copy(sourcePath);
       
   749         iUint1 = 0;
       
   750         
       
   751         TRAP(err, DoFindEntriesRecursiveL(_L("*"), sourcePath));    // recursively under directories of current directory entry
       
   752         if ( iFileManObserverResult != MFileManObserver::ECancel )
       
   753             {
       
   754             TRAP(err, DoFindEntries(_L("*"), sourcePath));              // entries under current directory entry
       
   755             }
       
   756         
       
   757         if ( iFileManObserverResult != MFileManObserver::ECancel )
       
   758             {
       
   759             // do the operation for a current directory entry as well
       
   760             err = FileOpRmDir(sourcePath, 0);
       
   761             }
       
   762         }
       
   763 
       
   764     else if (aSourceEntry.iEntry.IsDir())
       
   765         {
       
   766         sourcePath.Append(_L("\\"));
       
   767     
       
   768         // do the operation for a directory entry
       
   769         err = FileOpRmDir(sourcePath, 0);
       
   770         }
       
   771 
       
   772     else
       
   773         {
       
   774         // do the operation for a file entry
       
   775         err = FileOpDeleteFile(sourcePath, 0);
       
   776         }
       
   777     if ( !iOperationError && iFileManObserverResult == MFileManObserver::ECancel )
       
   778         {
       
   779         iOperationError = KErrCancel;
       
   780         }
       
   781     return iOperationError; 
       
   782     }
       
   783 
       
   784 // --------------------------------------------------------------------------------------------
       
   785 
       
   786 TInt CFileBrowserFileOps::FileOpDeleteFile(const TDesC& aName, TUint aSwitch) 
       
   787     {
       
   788     TInt err = DoFileOpDeleteFile(aName, aSwitch);
       
   789 
       
   790     // if locked, unlock the file and retry
       
   791     if (iEngine->Settings().iRemoveFileLocks && err == KErrInUse)
       
   792         {
       
   793         // try to remove the file lock by activating secure backup mode
       
   794         if (ActivateSecureBackUpViaFileOp() == KErrNone)
       
   795             {
       
   796             // try the operation several times
       
   797             for (TInt i=0; i<KMaxFileLockAttempts; i++)
       
   798                 {
       
   799                 err = DoFileOpDeleteFile(aName, aSwitch);
       
   800                 
       
   801                 if (err != KErrInUse)
       
   802                     break;
       
   803                 else
       
   804                     User::After(KSecureBackupLoopDelay);
       
   805                 }
       
   806             }
       
   807         }
       
   808 
       
   809     // if write protected or system file, remove protections and retry
       
   810     else if (iEngine->Settings().iIgnoreProtectionsAtts && (err == KErrAccessDenied || err == KErrNotFound))
       
   811         {
       
   812         // remove protections  and try again
       
   813         if (FileOpAttribs(aName, 0, KEntryAttReadOnly|KEntryAttSystem|KEntryAttHidden, 0, 0) == KErrNone)
       
   814             {
       
   815             err = DoFileOpDeleteFile(aName, aSwitch);
       
   816             }
       
   817         }
       
   818 
       
   819     // remember the "lowest" error
       
   820     if (err < iOperationError)
       
   821         iOperationError = err;
       
   822 
       
   823     LOGSTRING3("FileBrowser: FileOpDeleteFile %S, err=%d", &aName, err);
       
   824         
       
   825     return err; 
       
   826     }
       
   827         
       
   828 // --------------------------------------------------------------------------------------------
       
   829 
       
   830 TInt CFileBrowserFileOps::DoFileOpDeleteFile(const TDesC& aName, TUint aSwitch) 
       
   831     {
       
   832     #ifndef FILEBROWSER_LITE
       
   833     if (iEngine->Settings().iBypassPlatformSecurity)
       
   834         {
       
   835         if (!iFileOpClient)
       
   836             iFileOpClient = CFBFileOpClient::NewL();   
       
   837 
       
   838         return iFileOpClient->Delete(aName, aSwitch);
       
   839         }
       
   840     else
       
   841         {
       
   842     #endif
       
   843 //        CAsyncWaiter* waiter = CAsyncWaiter::NewLC();
       
   844 //        TInt result = iFileMan->Delete( aName, aSwitch, waiter->iStatus );
       
   845 //        waiter->StartAndWait();
       
   846 //        if ( iFileManObserverResult == MFileManObserver::ECancel ) result = KErrCancel;
       
   847 //        if ( !result ) result = waiter->Result();
       
   848 //        CleanupStack::PopAndDestroy( waiter );
       
   849 		TInt result = iFileMan->Delete( aName, aSwitch );
       
   850         return result;
       
   851     #ifndef FILEBROWSER_LITE
       
   852         }    
       
   853     #endif
       
   854     }
       
   855 
       
   856 // --------------------------------------------------------------------------------------------
       
   857 
       
   858 TInt CFileBrowserFileOps::FileOpRmDir(const TDesC& aName, TUint aSwitch) 
       
   859     {
       
   860     TInt err = DoFileOpRmDir(aName, aSwitch);
       
   861 
       
   862     // if write protected or system directory, remove protections and retry
       
   863     if (iEngine->Settings().iIgnoreProtectionsAtts && (err == KErrAccessDenied || err == KErrInUse))
       
   864         {
       
   865         // remove protections and try again
       
   866         if (FileOpAttribs(aName.Left(aName.Length()-1), 0, KEntryAttReadOnly|KEntryAttSystem|KEntryAttHidden, 0, 0) == KErrNone)
       
   867             {
       
   868             err = DoFileOpRmDir(aName, aSwitch);
       
   869             }
       
   870         }
       
   871 
       
   872     // remember the "lowest" error
       
   873     if (err < iOperationError)
       
   874         iOperationError = err;
       
   875 
       
   876     LOGSTRING3("FileBrowser: FileOpRmDir %S, err=%d", &aName, err);
       
   877         
       
   878     return err; 
       
   879     }
       
   880         
       
   881 // --------------------------------------------------------------------------------------------
       
   882 
       
   883 TInt CFileBrowserFileOps::DoFileOpRmDir(const TDesC& aDirName, TUint aSwitch)
       
   884     {
       
   885     #ifndef FILEBROWSER_LITE
       
   886     if (iEngine->Settings().iBypassPlatformSecurity)
       
   887         {
       
   888         if (!iFileOpClient)
       
   889             iFileOpClient = CFBFileOpClient::NewL();   
       
   890 
       
   891         return iFileOpClient->RmDir(aDirName, aSwitch);
       
   892         }
       
   893     else
       
   894         {
       
   895     #endif
       
   896         if ( aSwitch & CFileMan::ERecurse )
       
   897             {
       
   898 //            CAsyncWaiter* waiter = CAsyncWaiter::NewLC();
       
   899 //            TInt result = iFileMan->RmDir( aDirName, waiter->iStatus );
       
   900 //            waiter->StartAndWait();
       
   901 //            if ( iFileManObserverResult == MFileManObserver::ECancel ) result = KErrCancel;
       
   902 //            if ( !result ) result = waiter->Result();
       
   903 //            CleanupStack::PopAndDestroy( waiter);
       
   904             TInt result = iFileMan->RmDir( aDirName );
       
   905             return result;
       
   906             }
       
   907         else
       
   908             return iFs.RmDir(aDirName);    
       
   909     #ifndef FILEBROWSER_LITE
       
   910         }    
       
   911     #endif
       
   912    }
       
   913 
       
   914 // --------------------------------------------------------------------------------------------
       
   915 // --------------------------------------------------------------------------------------------
       
   916 
       
   917 TInt CFileBrowserFileOps::MkDirAll(const TDesC& aPath, TInt aSetAtts, TBool aQuickOperation) 
       
   918     {
       
   919     iFileManObserverResult = MFileManObserver::EContinue;
       
   920     if (aQuickOperation)
       
   921         return DoFileOpMkDirAll(aPath);
       
   922     else
       
   923         return FileOpMkDirAll(aPath, aSetAtts);
       
   924     }
       
   925 
       
   926 // --------------------------------------------------------------------------------------------
       
   927 
       
   928 TInt CFileBrowserFileOps::FileOpMkDirAll(const TDesC& aPath, TInt aSetAtts) 
       
   929     {
       
   930     TInt err = DoFileOpMkDirAll(aPath);
       
   931 
       
   932     // if the directory already exists, it is not an error    
       
   933     if (err == KErrAlreadyExists)
       
   934         err = KErrNone;
       
   935     
       
   936     
       
   937     // set attributes for directory just created
       
   938     if (aSetAtts > 0 && err == KErrNone && aPath.Length() > 3)
       
   939         {
       
   940         // a path has a trailing backslash so it needs to be removed before the call
       
   941         err = FileOpAttribs(aPath.Left(aPath.Length()-1), aSetAtts, 0, 0, 0);
       
   942         }
       
   943     
       
   944 
       
   945     // remember the "lowest" error
       
   946     if (err < iOperationError)
       
   947         iOperationError = err;
       
   948     
       
   949     LOGSTRING3("FileBrowser: FileOpMkDirAll %S, err=%d", &aPath, err);
       
   950     
       
   951     return err;
       
   952     }
       
   953         
       
   954 // --------------------------------------------------------------------------------------------
       
   955 
       
   956 TInt CFileBrowserFileOps::DoFileOpMkDirAll(const TDesC& aPath) 
       
   957     {
       
   958     #ifndef FILEBROWSER_LITE
       
   959     if (iEngine->Settings().iBypassPlatformSecurity)
       
   960         {
       
   961         if (!iFileOpClient)
       
   962             iFileOpClient = CFBFileOpClient::NewL();   
       
   963 
       
   964         return iFileOpClient->MkDirAll(aPath);
       
   965         }
       
   966     else
       
   967         {
       
   968     #endif
       
   969         return iFs.MkDirAll(aPath);
       
   970     #ifndef FILEBROWSER_LITE
       
   971         }    
       
   972     #endif
       
   973     }
       
   974 
       
   975 // --------------------------------------------------------------------------------------------
       
   976 // --------------------------------------------------------------------------------------------
       
   977 
       
   978 TInt CFileBrowserFileOps::CreateEmptyFile(const TDesC& aName) 
       
   979     {
       
   980     return DoFileOpCreateEmptyFile(aName);
       
   981     }
       
   982 
       
   983 // --------------------------------------------------------------------------------------------
       
   984 
       
   985 TInt CFileBrowserFileOps::FileOpCreateEmptyFile(const TDesC& aName) 
       
   986     {
       
   987     TInt err = DoFileOpCreateEmptyFile(aName);
       
   988 
       
   989     // remember the "lowest" error
       
   990     if (err < iOperationError)
       
   991         iOperationError = err;
       
   992     
       
   993     LOGSTRING3("FileBrowser: FileOpCreateEmptyFile %S, err=%d", &aName, err);
       
   994     
       
   995     return err;
       
   996     }
       
   997 
       
   998 // --------------------------------------------------------------------------------------------
       
   999     
       
  1000 TInt CFileBrowserFileOps::DoFileOpCreateEmptyFile(const TDesC& aName) 
       
  1001     {
       
  1002     #ifndef FILEBROWSER_LITE
       
  1003     if (iEngine->Settings().iBypassPlatformSecurity)
       
  1004         {
       
  1005         if (!iFileOpClient)
       
  1006             iFileOpClient = CFBFileOpClient::NewL();   
       
  1007 
       
  1008         return iFileOpClient->CreateEmptyFile(aName);
       
  1009         }
       
  1010     else
       
  1011         {
       
  1012     #endif
       
  1013         TInt err(KErrNone);
       
  1014             
       
  1015         RFile newFile;
       
  1016         err = newFile.Create(iFs, aName, EFileShareExclusive);
       
  1017         if (err == KErrNone)
       
  1018             err = newFile.Flush(); 
       
  1019         newFile.Close();
       
  1020         
       
  1021         return err; 
       
  1022     #ifndef FILEBROWSER_LITE
       
  1023         }    
       
  1024     #endif
       
  1025     }
       
  1026 
       
  1027 // --------------------------------------------------------------------------------------------
       
  1028 
       
  1029 TInt CFileBrowserFileOps::DriveSnapShot(TChar aSourceDriveLetter, TChar aTargetDriveLetter)
       
  1030     {
       
  1031     TInt err(KErrNone);
       
  1032     iFileManObserverResult = MFileManObserver::EContinue;
       
  1033     
       
  1034     // remember old settings and force them to be true for this operation
       
  1035     TBool currentRemoveFileLocksValue = iEngine->Settings().iRemoveFileLocks;
       
  1036     TBool currentIgnoreProtectionAttsValue = iEngine->Settings().iIgnoreProtectionsAtts;
       
  1037     TBool currentRemoveROMWriteProrection = iEngine->Settings().iRemoveROMWriteProrection;
       
  1038     iEngine->Settings().iRemoveFileLocks = ETrue;
       
  1039     iEngine->Settings().iIgnoreProtectionsAtts = ETrue;
       
  1040     iEngine->Settings().iRemoveROMWriteProrection = ETrue;
       
  1041 
       
  1042     
       
  1043     TFileName sourceDir;
       
  1044     sourceDir.Append(aSourceDriveLetter);
       
  1045     sourceDir.Append(_L(":"));
       
  1046 
       
  1047     _LIT(KTargetDir, "%c:\\SnapShot_%c_drive");
       
  1048     TFileName targetDir;
       
  1049     targetDir.Format(KTargetDir, TUint(aTargetDriveLetter), TUint(aSourceDriveLetter));            
       
  1050 
       
  1051     // remove any existing content, first get TEntry
       
  1052     TEntry entry;
       
  1053     err = iFs.Entry(targetDir, entry);
       
  1054 
       
  1055     // entry directory exists, delete it
       
  1056     if (err == KErrNone && entry.IsDir())
       
  1057         {
       
  1058         TFileName targetRoot;
       
  1059         targetRoot.Append(aTargetDriveLetter);
       
  1060         targetRoot.Append(_L(":\\"));
       
  1061 
       
  1062         TFileEntry targetEntry;
       
  1063         targetEntry.iPath = targetRoot;
       
  1064         targetEntry.iEntry = entry;
       
  1065 
       
  1066         err = Delete(targetEntry, CFileMan::ERecurse);                
       
  1067         }
       
  1068         
       
  1069     // do not care if removing succeeded or not, just continue with copying    
       
  1070     TEntry fakeEntry;
       
  1071     fakeEntry.iAtt |= KEntryAttDir;
       
  1072 
       
  1073     TFileEntry sourceEntry;
       
  1074     sourceEntry.iPath = sourceDir;
       
  1075     sourceEntry.iEntry = fakeEntry;
       
  1076 
       
  1077     err = Copy(sourceEntry, targetDir, CFileMan::ERecurse|CFileMan::EOverWrite);                
       
  1078 
       
  1079 
       
  1080     // restore back settings
       
  1081     iEngine->Settings().iRemoveFileLocks = currentRemoveFileLocksValue;
       
  1082     iEngine->Settings().iIgnoreProtectionsAtts = currentIgnoreProtectionAttsValue;    
       
  1083     iEngine->Settings().iRemoveROMWriteProrection = currentRemoveROMWriteProrection;    
       
  1084 
       
  1085 
       
  1086     return iOperationError;
       
  1087     }
       
  1088 
       
  1089 // --------------------------------------------------------------------------------------------
       
  1090 
       
  1091 TInt CFileBrowserFileOps::EraseMBR(TUint aDriveNumber) 
       
  1092     {
       
  1093     #ifndef FILEBROWSER_LITE
       
  1094 
       
  1095         if (!iFileOpClient)
       
  1096             iFileOpClient = CFBFileOpClient::NewL();
       
  1097         
       
  1098         return iFileOpClient->EraseMBR(aDriveNumber);
       
  1099 
       
  1100     #else
       
  1101         return KErrNotSupported;
       
  1102     #endif
       
  1103     }
       
  1104 
       
  1105 // --------------------------------------------------------------------------------------------
       
  1106 
       
  1107 TInt CFileBrowserFileOps::PartitionDrive(TUint aDriveNumber, TUint aNumberOfPartitions) 
       
  1108     {
       
  1109     #ifndef FILEBROWSER_LITE
       
  1110 
       
  1111         if (!iFileOpClient)
       
  1112             iFileOpClient = CFBFileOpClient::NewL();
       
  1113         
       
  1114         return iFileOpClient->PartitionDrive(aDriveNumber, aNumberOfPartitions);
       
  1115 
       
  1116     #else
       
  1117         return KErrNotSupported
       
  1118     #endif
       
  1119     }
       
  1120 
       
  1121 // --------------------------------------------------------------------------------------------
       
  1122 
       
  1123 MFileManObserver::TControl CFileBrowserFileOps::NotifyFileManStarted()
       
  1124     {
       
  1125     return iFileManObserverResult;
       
  1126     }
       
  1127 
       
  1128 // --------------------------------------------------------------------------------------------
       
  1129 
       
  1130 MFileManObserver::TControl CFileBrowserFileOps::NotifyFileManOperation()
       
  1131     {
       
  1132     return iFileManObserverResult;
       
  1133     }
       
  1134 // --------------------------------------------------------------------------------------------
       
  1135 
       
  1136 MFileManObserver::TControl CFileBrowserFileOps::NotifyFileManEnded()
       
  1137     {
       
  1138     return iFileManObserverResult;
       
  1139     }
       
  1140 
       
  1141 // --------------------------------------------------------------------------------------------
       
  1142 
       
  1143 void CFileBrowserFileOps::CancelOp()
       
  1144     {
       
  1145 #ifndef FILEBROWSER_LITE
       
  1146 
       
  1147     if ( iEngine->Settings().iBypassPlatformSecurity )
       
  1148         {
       
  1149         if ( !iFileOpClient )
       
  1150             iFileOpClient = CFBFileOpClient::NewL();
       
  1151         
       
  1152         iFileOpClient->CancelOp();
       
  1153         }
       
  1154 
       
  1155     // we need this information even when using iFileOpClient
       
  1156     // to be able to not execute aggregate operations 
       
  1157     iFileManObserverResult = MFileManObserver::ECancel;
       
  1158     
       
  1159 #else
       
  1160     iFileManObserverResult = MFileManObserver::ECancel;
       
  1161 #endif
       
  1162     }
       
  1163 
       
  1164 // End of File