filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp
changeset 18 edd66bde63a4
parent 16 ada7962b4308
child 21 15299bc55001
--- a/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp	Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp	Fri May 14 15:42:43 2010 +0300
@@ -98,8 +98,18 @@
 	    QList<FmBkupBackupCategory*> backupCategoryList,
 	    QString drive, quint32 content)
 {
+    FmLogger::log( "FmBkupEnginePrivate::startBackup_with drive: " + drive +
+            "_number:" + QString::number(DriverNameToNumber( drive )));
     if( drive.isEmpty() ) {
         iError = KErrPathNotFound;
+        FmLogger::log( "FmBkupEnginePrivate::startBackup_with return with KErrPathNotFound because drive is empty" );
+        return false;
+    }
+    QStringList backupableDriveList;
+    getBackupDriveList( backupableDriveList );
+    if( !backupableDriveList.contains( drive, Qt::CaseInsensitive ) ) {
+        iError = KErrPathNotFound;
+        FmLogger::log( "FmBkupEnginePrivate::startBackup_with return with KErrPathNotFound because drive is not available" );
         return false;
     }
     QString logString;
@@ -183,10 +193,9 @@
     FmLogger::log( logString );
 
     QList< FmRestoreInfo > restoreInfoList;
-    TInt driveNumber = DriverNameToNumber( drive );
-    GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, driveNumber );
+    GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, drive );
     
-    for ( TInt i( 0 ); i < restoreInfoList.count(); i++ )
+    for ( TInt i( 0 ); i < restoreInfoList.count(); ++i )
         {        
         bool toContinue = false;
         FmRestoreInfo &info = restoreInfoList[ i ];
@@ -405,6 +414,7 @@
 
 int FmBkupEnginePrivate::error()
 {
+    FmLogger::log( "FmBkupEnginePrivate::error:" + QString::number( iError ) );
     switch (iError) 
     {
     case KErrNone: 
@@ -419,6 +429,12 @@
         return FmErrCancel;
     case KErrPathNotFound:
         return FmErrPathNotFound;
+    case KErrLocked:
+        return FmErrLocked;
+    case KErrCorrupt:
+        return FmErrCorrupt;
+    case KErrNotReady:
+        return FmErrNotReady;
     default: 
         return FmErrUnKnown;
     }    
@@ -650,8 +666,9 @@
 
 void FmBkupEnginePrivate::GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
         QList< FmRestoreInfo > &restoreInfoList,
-        const TInt aDrive )
+        const QString& aDrive )
     {
+    int targetDrive = DriverNameToNumber( aDrive );
     FmBackupSettings& settings( *( q->BackupSettingsL() ) );
 
     restoreInfoList.clear();
@@ -684,7 +701,7 @@
         archives,
         params,
         AllowedDriveAttMatchMask(),
-        aDrive );
+        targetDrive );
 
     // Fill restore info
     TInt count( archives.Count() );
@@ -750,6 +767,9 @@
 
 TInt FmBkupEnginePrivate::DriverNameToNumber( QString driverName )
     {
+        if( driverName.isEmpty() ) {
+            return KErrNotFound;
+        }
         TInt drive = 0;
         drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
         return drive;
@@ -784,7 +804,6 @@
                 }
             }
         }
-    
     fs.Close();
     }