filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp
changeset 32 39cf9ced4cc4
parent 25 b7bfdea70ca2
child 33 328cf6fbe40c
--- a/filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp	Fri Jul 09 11:17:55 2010 +0800
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp	Fri Jul 23 11:12:24 2010 +0800
@@ -177,7 +177,6 @@
         {
         mErrString.clear();
         FmOperationCopy *operationCopy = static_cast<FmOperationCopy*>(mOperationBase);
-        QString refreshDestPath = QFileInfo( operationCopy->targetPath() ).dir().absolutePath();
         
         int ret = operationCopy->start( &mStop, &mErrString );
         switch( ret )
@@ -187,14 +186,15 @@
             break;
         case FmErrNone:
             emit notifyFinish();
-            emit refreshModel( refreshDestPath );
             break;
         default:
             emit notifyError( ret, mErrString );
             break;
         }
-        // refresh driveview no care if cancel, error or finished.
-        emit refreshModel( QString("") );
+        // refresh drive space no care if cancel, error or finished.
+        // as filemanger cannot notify drive space changed
+        // do not refresh path as QFileSystemModel will do auto-refresh
+        emit driveSpaceChanged();
         break;
         }
     case FmOperationService::EOperationTypeMove:
@@ -202,8 +202,6 @@
         mErrString.clear();
         FmOperationMove *operationMove = static_cast<FmOperationMove*>(mOperationBase);
         
-        QString refreshSrcPath = QFileInfo( operationMove->sourceList().front() ).dir().absolutePath();
-
         int ret = operationMove->start( &mStop, &mErrString );
         switch( ret )
         {
@@ -212,14 +210,14 @@
             break;
         case FmErrNone:
             emit notifyFinish();
-            emit refreshModel( refreshSrcPath );
-            emit refreshModel( operationMove->targetPath() );
             break;
         default:
             emit notifyError( ret, mErrString );
         }
-        // refresh driveview no care if cancel, error or finished.
-        emit refreshModel( QString("") );
+        // refresh drive space no care if cancel, error or finished.
+        // as filemanger cannot notify drive space changed
+        // do not refresh path as QFileSystemModel will do auto-refresh
+        emit driveSpaceChanged();
         break;
         }
     case FmOperationService::EOperationTypeRemove:
@@ -227,8 +225,6 @@
         mErrString.clear();
         FmOperationRemove *operationRemove = static_cast<FmOperationRemove*>(mOperationBase);
         
-        QString refreshSrcPath = QFileInfo( operationRemove->pathList().front() ).dir().absolutePath();
-        
         int ret = operationRemove->start( &mStop, &mErrString );
         switch( ret )
         {
@@ -241,27 +237,30 @@
         default:
             emit notifyError( ret, mErrString );
         }
-        // refresh driveview no care if cancel, error or finished.
-        emit refreshModel( QString("") );
+        // refresh drive space no care if cancel, error or finished.
+        // as filemanger cannot notify drive space changed
+        // do not refresh path as QFileSystemModel will do auto-refresh
+        emit driveSpaceChanged();
         break;
         }
     case FmOperationService::EOperationTypeFormat:
         {
 //        emit notifyWaiting( false );
-        FmLogger::log(QString("start format"));
+        FM_LOG(QString("start format"));
         FmOperationFormat *operationFormat = static_cast<FmOperationFormat*>( mOperationBase );
-        FmLogger::log(QString("get param and start format"));
+        FM_LOG(QString("get param and start format"));
 
-        QString refreshSrcPath = operationFormat->driverName();
-//        if ( FmErrNone != FmUtils::formatDrive( operationFormat->driverName() ) ) {
         if ( FmErrNone != operationFormat->start() ) {
             emit notifyError(  FmErrTypeFormatFailed, operationFormat->driverName() );
             return;
         }
-        FmLogger::log(QString("format done"));
+        FM_LOG(QString("format done"));
         emit notifyFinish();
-        emit refreshModel( refreshSrcPath );
-        FmLogger::log(QString("format done and emit finish"));
+        // refresh drive space no care if cancel, error or finished.
+        // as filemanger cannot notify drive space changed
+        // do not refresh path as QFileSystemModel will do auto-refresh
+        emit driveSpaceChanged();
+        FM_LOG(QString("format done and emit finish"));
         break;
         }
     case FmOperationService::EOperationTypeDriveDetails: