filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp
changeset 41 fc4654ce4fcb
parent 35 060d0b1ab845
child 48 1bebd60c0f00
--- a/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp	Wed Aug 18 09:39:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp	Thu Sep 02 20:16:57 2010 +0300
@@ -20,6 +20,7 @@
 #include "fmoperationthread.h"
 #include "fmbackupconfigloader.h"
 #include "fmbkupengine.h"
+#include "fmbackupsettings.h"
 #include "fmviewdetailsdialog.h"
 #include "fmoperationresultprocesser.h"
 #include "fmoperationcopyormove.h"
@@ -65,13 +66,10 @@
  * Constructs one operation Service with \a parent.
  */
 FmOperationService::FmOperationService( QObject *parent ) : QObject( parent ),
-        mCurrentOperation( 0 )
+        mCurrentOperation( 0 ), mBackupRestoreHandler( 0 )
 {
     mThread = new FmOperationThread( this );
     mThread->setObjectName( "operationThread" );
-    mBackupRestoreHandler = new FmBackupRestoreHandler( this );
-    mBackupRestoreHandler->setObjectName( "backupRestore" ) ;
-
     mOperationResultProcesser = new FmOperationResultProcesser( this );
     
     QMetaObject::connectSlotsByName( this );
@@ -83,7 +81,9 @@
 FmOperationService::~FmOperationService()
 {
     delete mThread;    
+    mThread = 0;
     delete mBackupRestoreHandler;
+    mBackupRestoreHandler = 0;
 }
 
 /*
@@ -95,7 +95,7 @@
 }
 
 /*
- * Copys the file or foler \a targetPath asynchronously. 
+ * Copies the file or foler \a targetPath asynchronously. 
  */
 int FmOperationService::asyncCopy( const QStringList &sourceList, const QString &targetPath )
 {    
@@ -204,7 +204,11 @@
         return FmErrAlreadyStarted;
     Q_ASSERT( !mCurrentOperation );
 
-    FmOperationBackup *operationBackup = new FmOperationBackup( mBackupRestoreHandler );
+    // BackupSettingsL will not leave, coding convention will be improvied in another task.
+    QString targetDrive( backupRestoreHandler()->bkupEngine()->BackupSettingsL()->availableTargetDrive() );
+    quint32 content( backupRestoreHandler()->bkupEngine()->BackupSettingsL()->content() );
+    FmOperationBackup *operationBackup = 
+            new FmOperationBackup( backupRestoreHandler(), targetDrive, content );
     mCurrentOperation = operationBackup;
     int ret = backupRestoreHandler()->startBackup( operationBackup );
     if( ret ){
@@ -242,7 +246,7 @@
  */
 int FmOperationService::syncDeleteBackup( quint64 selection )
 {
-    return mBackupRestoreHandler->deleteBackup( selection );
+    return backupRestoreHandler()->deleteBackup( selection );
 }
 
 /*
@@ -325,7 +329,8 @@
 FmBackupRestoreHandler *FmOperationService::backupRestoreHandler()
 {
     if( !mBackupRestoreHandler ) {
-        mBackupRestoreHandler = new FmBackupRestoreHandler( this );
+        mBackupRestoreHandler = new FmBackupRestoreHandler( this );        
+        mBackupRestoreHandler->setObjectName( "backupRestore" ) ;
         QMetaObject::connectSlotsByName( this );
     }
     return mBackupRestoreHandler;