--- a/filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.cpp Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.cpp Thu Sep 02 17:00:51 2010 +0800
@@ -100,12 +100,11 @@
mCopiedOrMovedSize = 0;
mCurrentStep = 0;
- if( mSourceList.empty() ) {
+ if ( mSourceList.empty() ) {
emit notifyError( FmErrWrongParam, mErrString );
return ;
}
-
- emit notifyPreparing( true );
+ emit notifyPreparing( true );
int numofFolders = 0;
int numofFiles = 0;
@@ -115,8 +114,11 @@
if( ret != FmErrNone ) {
emit notifyError( ret, mErrString );
return;
- }
-
+ }
+ if ( !targetHasEnoughSpace() ) {
+ emit notifyError( FmErrDiskFull, mErrString );
+ return;
+ }
emit notifyStart( true, mTotalSteps );
foreach( const QString& source, mSourceList ) {
@@ -210,6 +212,13 @@
int ret = FmErrNone;
if ( fi.isFile() ) {
+ if ( FmUtils::getDriveLetterFromPath( source ) ==
+ FmUtils::getDriveLetterFromPath( targetPath ) &&
+ operationType() == FmOperationService::EOperationTypeMove )
+ {
+ return FmUtils::moveInsideDrive( source, newName );
+
+ }
quint64 fileSize = fi.size();
ret = copyOneFile( source, newName );
if (ret != FmErrNone) {
@@ -364,7 +373,7 @@
}
/*
- * Copys one file from \a srcFile to \a desFile
+ * Copies one file from \a srcFile to \a desFile
*/
int FmOperationCopyOrMove::copyOneFile( const QString &srcFile, const QString &desFile )
{
@@ -424,3 +433,14 @@
}
}
+bool FmOperationCopyOrMove::targetHasEnoughSpace()
+{
+ QString sourceDrive = FmUtils::getDriveLetterFromPath( mSourceList.front() );
+ QString targetDrive = FmUtils::getDriveLetterFromPath( mTargetPath );
+ if ( sourceDrive == targetDrive &&
+ operationType() == FmOperationService::EOperationTypeMove ) {
+ return true;
+ } else {
+ return FmUtils::hasEnoughSpace( targetDrive, mTotalSize );
+ }
+}