filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp
changeset 16 ada7962b4308
parent 14 1957042d8c7e
child 18 edd66bde63a4
child 25 b7bfdea70ca2
child 37 15bc28c9dd51
--- a/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp	Fri Apr 16 14:53:38 2010 +0300
+++ b/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp	Mon May 03 12:24:39 2010 +0300
@@ -19,12 +19,6 @@
 #include "fmbkupengine_p.h"
 
 // INCLUDE FILES
-/*#include <filemanagerengine.rsg>
-#include "cfilemanagerremovabledrivehandler.h"
-#include "mfilemanagerprocessobserver.h"
-#include "cfilemanagerutils.h"
-#include "cfilemanagerengine.h"
-*/
 #include <coreapplicationuisdomainpskeys.h>
 #include <coemain.h>
 #include <apgwgnam.h>
@@ -49,6 +43,8 @@
 
 #include "fmcommon.h"
 
+#include <f32file.h>
+
 /*
 #include "cfilemanageritemproperties.h"
 #include "cfilemanagerbackupsettings.h"
@@ -102,6 +98,10 @@
 	    QList<FmBkupBackupCategory*> backupCategoryList,
 	    QString drive, quint32 content)
 {
+    if( drive.isEmpty() ) {
+        iError = KErrPathNotFound;
+        return false;
+    }
     QString logString;
     logString = "startBackup";
     FmLogger::log( logString );
@@ -182,6 +182,31 @@
     logString = "startBackup_StartOperationL";
     FmLogger::log( logString );
 
+    QList< FmRestoreInfo > restoreInfoList;
+    TInt driveNumber = DriverNameToNumber( drive );
+    GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, driveNumber );
+    
+    for ( TInt i( 0 ); i < restoreInfoList.count(); i++ )
+        {        
+        bool toContinue = false;
+        FmRestoreInfo &info = restoreInfoList[ i ];
+        TUint32 existContent( FmgrToBkupMask( info.content() ) );
+        if ( bkupContent & existContent )
+            {            
+            notifyBackupFilesExistInternal( toContinue );
+            if (!toContinue)
+                {
+                iError = KErrAlreadyExists;
+                return false;
+                }
+            else
+                {
+                break;
+                }
+            }
+        }
+    
+    
     TRAPD( err, iBkupEngine->StartOperationL(
         EMMCScBkupOperationTypeFullBackup, *this, params ) );
 
@@ -277,6 +302,11 @@
 	emit notifyMemoryLow( memoryValue, userError );
 	}
 
+void FmBkupEnginePrivate::notifyBackupFilesExistInternal( bool &isContinue )
+    {
+    emit notifyBackupFilesExist( isContinue );
+    }
+
 TInt FmBkupEnginePrivate::HandleBkupEngineEventL(
         MMMCScBkupEngineObserver::TEvent aEvent, TInt aAssociatedData )
     {
@@ -332,7 +362,7 @@
             }
         case MMMCScBkupEngineObserver::ECommonOperationError:
             {
-            logString  = "ECommonOperationError:" + QString::number(aAssociatedData);
+            logString  = "ECommonOperationError";
             iError = aAssociatedData;
             break;
             }
@@ -387,6 +417,8 @@
         return FmErrAlreadyExists;
     case KErrCancel:
         return FmErrCancel;
+    case KErrPathNotFound:
+        return FmErrPathNotFound;
     default: 
         return FmErrUnKnown;
     }    
@@ -713,7 +745,7 @@
 
 TUint32 FmBkupEnginePrivate::AllowedDriveAttMatchMask() const
     {
-    return KDriveAttRemovable | KDriveAttInternal;//KDriveAttRemovable;
+    return KDriveAttRemovable;//KDriveAttRemovable;
     }
 
 TInt FmBkupEnginePrivate::DriverNameToNumber( QString driverName )
@@ -729,6 +761,33 @@
         return driverName;
     }
 
+void FmBkupEnginePrivate::getBackupDriveList( QStringList &driveList )
+    {
+    TUint32 driveAttMask( AllowedDriveAttMatchMask() );
+    RFs fs;
+    fs.Connect();
+    for ( TInt i( 0 ); i < KMaxDrives; ++i )
+        {
+        TDriveInfo driveInfo;
+        if ( fs.Drive( driveInfo, i ) == KErrNone )
+            {
+            // Do not allow backup for internal drives
+            TUint driveStatus( 0 );
+            DriveInfo::GetDriveStatus( fs, i, driveStatus );
+            if ( driveStatus & DriveInfo::EDriveInternal )
+                {
+                continue;
+                }
+            if ( driveInfo.iDriveAtt & driveAttMask )
+                {
+                driveList.append( NumberToDriverName( i ) );
+                }
+            }
+        }
+    
+    fs.Close();
+    }
+
 // -----------------------------------------------------------------------------
 // CFileManagerEngine::PublishBurStatus()
 //