equal
deleted
inserted
replaced
18 |
18 |
19 #include "fmoperationservice.h" |
19 #include "fmoperationservice.h" |
20 #include "fmoperationthread.h" |
20 #include "fmoperationthread.h" |
21 #include "fmbackupconfigloader.h" |
21 #include "fmbackupconfigloader.h" |
22 #include "fmbkupengine.h" |
22 #include "fmbkupengine.h" |
|
23 #include "fmbackupsettings.h" |
23 #include "fmviewdetailsdialog.h" |
24 #include "fmviewdetailsdialog.h" |
24 #include "fmoperationresultprocesser.h" |
25 #include "fmoperationresultprocesser.h" |
25 #include "fmoperationcopyormove.h" |
26 #include "fmoperationcopyormove.h" |
26 #include "fmoperationremove.h" |
27 #include "fmoperationremove.h" |
27 #include "fmoperationformat.h" |
28 #include "fmoperationformat.h" |
63 |
64 |
64 /* |
65 /* |
65 * Constructs one operation Service with \a parent. |
66 * Constructs one operation Service with \a parent. |
66 */ |
67 */ |
67 FmOperationService::FmOperationService( QObject *parent ) : QObject( parent ), |
68 FmOperationService::FmOperationService( QObject *parent ) : QObject( parent ), |
68 mCurrentOperation( 0 ) |
69 mCurrentOperation( 0 ), mBackupRestoreHandler( 0 ) |
69 { |
70 { |
70 mThread = new FmOperationThread( this ); |
71 mThread = new FmOperationThread( this ); |
71 mThread->setObjectName( "operationThread" ); |
72 mThread->setObjectName( "operationThread" ); |
72 mBackupRestoreHandler = new FmBackupRestoreHandler( this ); |
|
73 mBackupRestoreHandler->setObjectName( "backupRestore" ) ; |
|
74 |
|
75 mOperationResultProcesser = new FmOperationResultProcesser( this ); |
73 mOperationResultProcesser = new FmOperationResultProcesser( this ); |
76 |
74 |
77 QMetaObject::connectSlotsByName( this ); |
75 QMetaObject::connectSlotsByName( this ); |
78 } |
76 } |
79 |
77 |
81 * Destructs the operation service. |
79 * Destructs the operation service. |
82 */ |
80 */ |
83 FmOperationService::~FmOperationService() |
81 FmOperationService::~FmOperationService() |
84 { |
82 { |
85 delete mThread; |
83 delete mThread; |
|
84 mThread = 0; |
86 delete mBackupRestoreHandler; |
85 delete mBackupRestoreHandler; |
|
86 mBackupRestoreHandler = 0; |
87 } |
87 } |
88 |
88 |
89 /* |
89 /* |
90 * Returns true if the thread is running, false if not. |
90 * Returns true if the thread is running, false if not. |
91 */ |
91 */ |
93 { |
93 { |
94 return mThread->isRunning(); |
94 return mThread->isRunning(); |
95 } |
95 } |
96 |
96 |
97 /* |
97 /* |
98 * Copys the file or foler \a targetPath asynchronously. |
98 * Copies the file or foler \a targetPath asynchronously. |
99 */ |
99 */ |
100 int FmOperationService::asyncCopy( const QStringList &sourceList, const QString &targetPath ) |
100 int FmOperationService::asyncCopy( const QStringList &sourceList, const QString &targetPath ) |
101 { |
101 { |
102 Q_ASSERT( !mCurrentOperation ); |
102 Q_ASSERT( !mCurrentOperation ); |
103 mCurrentOperation = new FmOperationCopyOrMove( this, FmOperationService::EOperationTypeCopy, sourceList, targetPath ); |
103 mCurrentOperation = new FmOperationCopyOrMove( this, FmOperationService::EOperationTypeCopy, sourceList, targetPath ); |
202 { |
202 { |
203 if ( isRunning() ) |
203 if ( isRunning() ) |
204 return FmErrAlreadyStarted; |
204 return FmErrAlreadyStarted; |
205 Q_ASSERT( !mCurrentOperation ); |
205 Q_ASSERT( !mCurrentOperation ); |
206 |
206 |
207 FmOperationBackup *operationBackup = new FmOperationBackup( mBackupRestoreHandler ); |
207 // BackupSettingsL will not leave, coding convention will be improvied in another task. |
|
208 QString targetDrive( backupRestoreHandler()->bkupEngine()->BackupSettingsL()->availableTargetDrive() ); |
|
209 quint32 content( backupRestoreHandler()->bkupEngine()->BackupSettingsL()->content() ); |
|
210 FmOperationBackup *operationBackup = |
|
211 new FmOperationBackup( backupRestoreHandler(), targetDrive, content ); |
208 mCurrentOperation = operationBackup; |
212 mCurrentOperation = operationBackup; |
209 int ret = backupRestoreHandler()->startBackup( operationBackup ); |
213 int ret = backupRestoreHandler()->startBackup( operationBackup ); |
210 if( ret ){ |
214 if( ret ){ |
211 return FmErrNone; |
215 return FmErrNone; |
212 } else { |
216 } else { |
240 * Delete backup synchronously. |
244 * Delete backup synchronously. |
241 * \a selection selected backup items |
245 * \a selection selected backup items |
242 */ |
246 */ |
243 int FmOperationService::syncDeleteBackup( quint64 selection ) |
247 int FmOperationService::syncDeleteBackup( quint64 selection ) |
244 { |
248 { |
245 return mBackupRestoreHandler->deleteBackup( selection ); |
249 return backupRestoreHandler()->deleteBackup( selection ); |
246 } |
250 } |
247 |
251 |
248 /* |
252 /* |
249 * Cancels current operation. |
253 * Cancels current operation. |
250 */ |
254 */ |
323 * Returns the backup handler. |
327 * Returns the backup handler. |
324 */ |
328 */ |
325 FmBackupRestoreHandler *FmOperationService::backupRestoreHandler() |
329 FmBackupRestoreHandler *FmOperationService::backupRestoreHandler() |
326 { |
330 { |
327 if( !mBackupRestoreHandler ) { |
331 if( !mBackupRestoreHandler ) { |
328 mBackupRestoreHandler = new FmBackupRestoreHandler( this ); |
332 mBackupRestoreHandler = new FmBackupRestoreHandler( this ); |
|
333 mBackupRestoreHandler->setObjectName( "backupRestore" ) ; |
329 QMetaObject::connectSlotsByName( this ); |
334 QMetaObject::connectSlotsByName( this ); |
330 } |
335 } |
331 return mBackupRestoreHandler; |
336 return mBackupRestoreHandler; |
332 } |
337 } |
333 |
338 |