filemanager/src/filemanager/src/operationservice/fmoperationbase.cpp
changeset 33 328cf6fbe40c
parent 25 b7bfdea70ca2
child 40 4167eb56f30d
--- a/filemanager/src/filemanager/src/operationservice/fmoperationbase.cpp	Fri Jul 23 11:12:24 2010 +0800
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationbase.cpp	Thu Aug 05 11:30:07 2010 +0800
@@ -19,114 +19,128 @@
 #include "fmoperationbase.h"
 #include "fmdrivedetailstype.h"
 #include <QtAlgorithms>
+/*
+ * \fn void showNote( const QString &note )
+ * This signal is emitted when operation needs operation service to show some note.
+ * \a note indicates the note to show. 
+ */
 
+/* \fn  void notifyWaiting( bool cancelable )
+ * This signal is emitted when operation needs operation service to wait.
+ * \a cancelable indicates whether it could be canceled.
+ */
+
+/* \fn  void notifyPreparing( bool cancelable )
+ * This signal is emitted when operation needs operation service to prepare.
+ * \a cancelable indicates whether it could be canceled.
+ */
+
+/* \fn  void notifyStart( bool cancelable, int maxSteps )
+ * This signal is emitted when operation starts and operation service shows progress bar.
+ * \a cancelable indicates whether it could be canceled.
+ * \a maxStep indicates the max of progress bar.
+ */
+    
+/* \fn  void notifyProgress( int currentStep )
+ * This signal is emitted when operation needs operation service update progress bar.
+ * \a currentStep the current step.
+ */
+
+/* \fn  void notifyFinish()
+ * This signal is emitted when operation finished.
+ */
+
+/* \fn  void notifyError( int error, const QString &errString )
+ * This signal is used to notify error.
+ * \a error the error id.
+ * \a errString the error string.
+ */
+    
+/*
+  Constructs the base operation with
+  \a parent parent
+  \a operationType the type of current operation.
+*/
 FmOperationBase::FmOperationBase( QObject *parent, FmOperationService::TOperationType operationType ) : 
     QObject( parent ), mOperationType( operationType )
 {
 }
 
+/*
+  Destructs the operation
+*/
 FmOperationBase::~FmOperationBase()
 {
 
 }
 
+/*
+  Returns the current operation type
+*/
 FmOperationService::TOperationType FmOperationBase::operationType()
 {
     return mOperationType;
 }
 
-
-//FmOperationFormat
-//FmOperationFormat::FmOperationFormat( QObject *parent, QString mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ),
-//    mDriverName( mDriverName )
-//{
-//}
-//FmOperationFormat::~FmOperationFormat()
-//{
-//}
-//
-//QString FmOperationFormat::driverName()
-//{
-//    return mDriverName;
-//}
-
-//FmOperationDriveDetails
-FmOperationDriveDetails::FmOperationDriveDetails( QObject *parent, QString driverName ) :
-        FmOperationBase( parent, FmOperationService::EOperationTypeDriveDetails ),
-        mDriverName( driverName )
-{
-}
-FmOperationDriveDetails::~FmOperationDriveDetails()
-{
-    qDeleteAll(mDetailsSizeList);
-}
-
-QString FmOperationDriveDetails::driverName()
-{
-    return mDriverName;
-}
-
-QList<FmDriveDetailsSize*> &FmOperationDriveDetails::detailsSizeList()
-{
-    return mDetailsSizeList;
-}
-
-//FmOperationFolderDetails
-FmOperationFolderDetails::FmOperationFolderDetails( QObject *parent, const QString folderPath ) :
-        FmOperationBase( parent, FmOperationService::EOperationTypeFolderDetails ),
-        mFolderPath( folderPath ),
-        mNumofSubFolders( 0 ),
-        mNumofFiles( 0 ),
-        mSizeofFolder( 0 )
-
-{
-}
-FmOperationFolderDetails::~FmOperationFolderDetails()
+/*
+  Starts the operation, called by FmOperationThread.
+  Use empty implementation because Backup and Restore 
+  are not done within thread, so they will not reimplement
+  this function.
+  \sa FmOperationThread::run
+*/
+void FmOperationBase::start( volatile bool */*isStopped*/ )
 {
 
 }
 
-QString FmOperationFolderDetails::folderPath()
-{
-    return mFolderPath;
-}
-
-int &FmOperationFolderDetails::numofSubFolders()
+/*
+  Does some additional work before starting the operation.
+  Returns the error number.
+*/
+int FmOperationBase::prepare()
 {
-    return mNumofSubFolders;
-}
-
-int &FmOperationFolderDetails::numofFiles()
-{
-    return mNumofFiles;
-}
-
-quint64 &FmOperationFolderDetails::sizeofFolder()
-{
-    return mSizeofFolder;
+    return FmErrNone;
 }
 
 
-
+/*
+  Constructs a backup operation with
+  \a parent parent
+*/
 FmOperationBackup::FmOperationBackup( QObject *parent )
     : FmOperationBase( parent, FmOperationService::EOperationTypeBackup )
 {
 }
 
+
+/*
+  Destructs the backup operation
+*/
 FmOperationBackup::~FmOperationBackup()
 {
 }
 
-
+/*
+  Constructs a restore operation with
+  \a parent parent
+  \a selection the selected backup items
+*/
 FmOperationRestore::FmOperationRestore( QObject *parent, quint64 selection )
     : FmOperationBase( parent, FmOperationService::EOperationTypeRestore ), mSelection( selection )
 {
 }
 
+/*
+  Destructs the restore operation
+*/
 FmOperationRestore::~FmOperationRestore()
 {
 }
 
+/*
+  Returns the backup items
+*/
 quint64 FmOperationRestore::selection()
 {
     return mSelection;