55 explicit FmOperationService( QObject *parent ); |
55 explicit FmOperationService( QObject *parent ); |
56 ~FmOperationService(); |
56 ~FmOperationService(); |
57 |
57 |
58 //return error if any path exist. |
58 //return error if any path exist. |
59 //renturn error if list count is not as the same the other. |
59 //renturn error if list count is not as the same the other. |
60 int asyncCopy( QStringList sourceList, QString targetPath ); |
60 int asyncCopy( const QStringList &sourceList, const QString &targetPath ); |
61 |
61 |
62 int asyncMove( QStringList sourceList, QString targetPath ); |
62 int asyncMove( const QStringList &sourceList, const QString &targetPath ); |
63 |
63 |
64 int asyncRemove( QStringList pathList ); |
64 int asyncRemove( const QStringList &pathList ); |
65 |
65 |
66 //return error if can not be format. |
66 //return error if can not be format. |
67 //notify error while format error. |
67 //notify error while format error. |
68 int asyncFormat( QString driverName ); |
68 int asyncFormat( const QString &driverName ); |
69 int asyncViewDriveDetails( const QString driverName ); |
69 int asyncViewDriveDetails( const QString &driverName ); |
70 int asyncViewFolderDetails( const QString folderPath ); |
70 int asyncViewFolderDetails( const QString &folderPath ); |
71 int asyncBackup(); |
71 int asyncBackup(); |
72 int asyncRestore( quint64 selection ); |
72 int asyncRestore( quint64 selection ); |
73 |
73 |
74 void cancelOperation(); |
74 void cancelOperation(); |
75 |
75 |
87 public slots: |
87 public slots: |
88 void on_backupRestore_notifyPreparing( bool cancelable ); |
88 void on_backupRestore_notifyPreparing( bool cancelable ); |
89 void on_backupRestore_notifyStart( bool cancelable, int maxSteps ); |
89 void on_backupRestore_notifyStart( bool cancelable, int maxSteps ); |
90 void on_backupRestore_notifyProgress( int currentStep ); |
90 void on_backupRestore_notifyProgress( int currentStep ); |
91 void on_backupRestore_notifyFinish(); |
91 void on_backupRestore_notifyFinish(); |
92 void on_backupRestore_notifyError(int error, QString errString ); |
92 void on_backupRestore_notifyError(int error, const QString &errString ); |
93 void on_backupRestore_notifyCanceled(); |
93 void on_backupRestore_notifyCanceled(); |
94 |
94 void on_operation_askForRename( const QString &srcFile, QString *destFile ); |
95 void on_operationThread_askForRename( const QString &srcFile, QString *destFile ); |
95 void on_operation_askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); |
96 void on_operationThread_askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); |
96 void on_operation_showNote( const char *noteString ); |
97 void on_operationThread_refreshModel( const QString &path ); |
97 void on_operation_notifyWaiting( bool cancelable ); |
98 void on_operationThread_notifyWaiting( bool cancelable ); |
98 void on_operation_notifyPreparing( bool cancelable ); |
99 void on_operationThread_notifyPreparing( bool cancelable ); |
99 void on_operation_notifyStart( bool cancelable, int maxSteps ); |
100 void on_operationThread_notifyStart( bool cancelable, int maxSteps ); |
100 void on_operation_notifyProgress( int currentStep ); |
101 void on_operationThread_notifyProgress( int currentStep ); |
101 void on_operation_notifyFinish(); |
102 void on_operationThread_notifyFinish(); |
102 void on_operation_notifyError(int error, QString errString ); |
103 void on_operationThread_notifyError(int error, QString errString ); |
103 void on_operation_driveSpaceChanged(); |
104 void on_operationThread_notifyCanceled(); |
|
105 |
104 |
106 signals: |
105 signals: |
107 // void askForRename( FmOperationBase* operationBase, const QString &srcFile, QString &destFile ); |
106 |
108 void refreshModel( FmOperationBase* operationBase, const QString& filePath ); |
107 void driveSpaceChanged( FmOperationBase* operationBase ); |
109 |
108 |
110 void notifyWaiting( FmOperationBase* operationBase, bool cancelable ); |
109 void notifyWaiting( FmOperationBase* operationBase, bool cancelable ); |
111 void notifyPreparing( FmOperationBase* operationBase, bool cancelable ); // this step could not be used if not needed. |
110 void notifyPreparing( FmOperationBase* operationBase, bool cancelable ); // this step could not be used if not needed. |
112 void notifyStart( FmOperationBase* operationBase, bool cancelable, int maxSteps ); |
111 void notifyStart( FmOperationBase* operationBase, bool cancelable, int maxSteps ); |
113 void notifyProgress( FmOperationBase* operationBase, int currentStep ); |
112 void notifyProgress( FmOperationBase* operationBase, int currentStep ); |
116 void notifyError( FmOperationBase* operationBase, int error, QString errString ); |
115 void notifyError( FmOperationBase* operationBase, int error, QString errString ); |
117 void notifyCanceled( FmOperationBase* operationBase ); |
116 void notifyCanceled( FmOperationBase* operationBase ); |
118 |
117 |
119 private: |
118 private: |
120 void resetOperation(); |
119 void resetOperation(); |
|
120 void connectSignalsAndSlots( FmOperationBase *operation ); |
121 |
121 |
122 private: |
122 private: |
123 FmOperationThread *mThread; |
123 FmOperationThread *mThread; |
124 FmBackupRestoreHandler *mBackupRestoreHandler; |
124 FmBackupRestoreHandler *mBackupRestoreHandler; |
125 FmOperationBase* mCurrentOperation; |
125 FmOperationBase* mCurrentOperation; |