70 QString newTargetPath = FmUtils::fillPathWithSplash( |
70 QString newTargetPath = FmUtils::fillPathWithSplash( |
71 srcFileInfo.absolutePath() ) + value; |
71 srcFileInfo.absolutePath() ) + value; |
72 QString errString; |
72 QString errString; |
73 // check if name/path is available for use. |
73 // check if name/path is available for use. |
74 if( !FmUtils::checkNewFolderOrFile( value, newTargetPath, errString ) ) { |
74 if( !FmUtils::checkNewFolderOrFile( value, newTargetPath, errString ) ) { |
75 FmDlgUtils::information( errString ); |
75 FmDlgUtils::warning( errString, HbMessageBox::Ok, true ); |
76 ret = FmDlgUtils::showTextQuery( questionText, value, regExpList, maxFileNameLength, QString(), false ); |
76 ret = FmDlgUtils::showTextQuery( questionText, value, regExpList, maxFileNameLength, QString(), false ); |
77 continue; |
77 continue; |
78 } else { |
78 } else { |
79 break; |
79 break; |
80 } |
80 } |
255 FmUtils::getDriveLetterFromPath( paramFolderDetails->folderPath() ) ); |
256 FmUtils::getDriveLetterFromPath( paramFolderDetails->folderPath() ) ); |
256 break; |
257 break; |
257 } |
258 } |
258 case FmOperationService::EOperationTypeFormat: |
259 case FmOperationService::EOperationTypeFormat: |
259 { |
260 { |
260 FmDlgUtils::information( QString( hbTrId("Format succeed!")) ); |
261 FmUtils::setSystem( false ); |
|
262 FmDlgUtils::information( QString( hbTrId("Format succeed!")), HbMessageBox::Ok, true ); |
261 FmOperationFormat *paramFormat = static_cast<FmOperationFormat*>( operationBase ); |
263 FmOperationFormat *paramFormat = static_cast<FmOperationFormat*>( operationBase ); |
262 QString title( hbTrId( "Drive name ") ); |
264 QString title( hbTrId( "Drive name ") ); |
263 QString driveName( paramFormat->driverName() ); |
265 QString driveName( paramFormat->driverName() ); |
264 FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driveName ); |
266 FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driveName ); |
265 FmDriverInfo::DriveState state = driverInfo.driveState(); |
267 FmDriverInfo::DriveState state = driverInfo.driveState(); |
323 // as QEventLoop::exec will cause some problem when used for blocking dialog. |
328 // as QEventLoop::exec will cause some problem when used for blocking dialog. |
324 // HbDialog has already removed exec function which is implemented with QEventLoop::exec. |
329 // HbDialog has already removed exec function which is implemented with QEventLoop::exec. |
325 // If need use QEventLoop::exec to block code execute sequence, It should be invoked in a Qt::QueuedConnection slot. |
330 // If need use QEventLoop::exec to block code execute sequence, It should be invoked in a Qt::QueuedConnection slot. |
326 return; |
331 return; |
327 case FmErrAlreadyStarted: |
332 case FmErrAlreadyStarted: |
328 FmDlgUtils::information( QString( hbTrId("Operation already started!")) ); |
333 FmDlgUtils::warning( QString( hbTrId("Operation already started!")) ); |
329 return; |
334 return; |
330 case FmErrLocked: |
335 case FmErrLocked: |
331 { |
336 { |
332 FmOperationBackup *operationBackup = qobject_cast<FmOperationBackup*>(operationBase); |
337 FmOperationBackup *operationBackup = qobject_cast<FmOperationBackup*>(operationBase); |
333 if( operationBackup ) { |
338 if( operationBackup ) { |
334 // special error note for backup |
339 // special error note for backup |
335 QString targetDrive( operationBackup->targetDrive() ); |
340 QString targetDrive( operationBackup->targetDrive() ); |
336 QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) ); |
341 QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) ); |
337 QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume ); |
342 QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume ); |
338 FmDlgUtils::information( QString( hbTrId("txt_fmgr_info_backup_locked") ).arg( driveString ) ); |
343 FmDlgUtils::warning( QString( hbTrId("txt_fmgr_info_backup_locked") ).arg( driveString ) ); |
339 } else { |
344 } else { |
340 FmDlgUtils::information( QString( hbTrId("Operation failed because drive is locked!")) ); |
345 FmDlgUtils::warning( QString( hbTrId("Operation failed because drive is locked!")) ); |
341 } |
346 } |
342 return; |
347 return; |
343 } |
348 } |
344 case FmErrPathNotFound: |
349 case FmErrPathNotFound: |
345 FmDlgUtils::information( QString( hbTrId("Operation failed because can not find target path or drive is not available!") ) ); |
350 FmDlgUtils::warning( QString( hbTrId("Operation failed because can not find target path or drive is not available!") ) ); |
346 return; |
351 return; |
347 case FmErrCorrupt: |
352 case FmErrCorrupt: |
348 { |
353 { |
349 FmOperationBackup *operationBackup = qobject_cast<FmOperationBackup*>(operationBase); |
354 FmOperationBackup *operationBackup = qobject_cast<FmOperationBackup*>(operationBase); |
350 if( operationBackup ) { |
355 if( operationBackup ) { |
351 // special error note for backup |
356 // special error note for backup |
352 QString targetDrive( operationBackup->targetDrive() ); |
357 QString targetDrive( operationBackup->targetDrive() ); |
353 QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) ); |
358 QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) ); |
354 QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume ); |
359 QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume ); |
355 FmDlgUtils::information( QString( hbTrId("txt_fmgr_info_backup_corrupted") ).arg( driveString ) ); |
360 FmDlgUtils::warning( QString( hbTrId("txt_fmgr_info_backup_corrupted") ).arg( driveString ) ); |
356 } else { |
361 } else { |
357 FmDlgUtils::information( QString( hbTrId("Operation failed because target media is corrupted!") ) ); |
362 FmDlgUtils::warning( QString( hbTrId("Operation failed because target media is corrupted!") ) ); |
358 } |
363 } |
359 return; |
364 return; |
360 } |
365 } |
361 case FmErrNotReady: // Caused when MMC & OTG is not inserted when start backup |
366 case FmErrNotReady: // Caused when MMC & OTG is not inserted when start backup |
362 { |
367 { |
364 if( operationBackup ) { |
369 if( operationBackup ) { |
365 // special error note for backup |
370 // special error note for backup |
366 QString targetDrive( operationBackup->targetDrive() ); |
371 QString targetDrive( operationBackup->targetDrive() ); |
367 QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) ); |
372 QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) ); |
368 QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume ); |
373 QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume ); |
369 FmDlgUtils::information( QString( hbTrId("txt_fmgr_info_backup_unavailable") ).arg( driveString ) ); |
374 FmDlgUtils::warning( QString( hbTrId("txt_fmgr_info_backup_unavailable") ).arg( driveString ) ); |
370 } else { |
375 } else { |
371 FmDlgUtils::information( QString( hbTrId("Operation failed because device is not ready!") ) ); |
376 FmDlgUtils::warning( QString( hbTrId("Operation failed because device is not ready!") ) ); |
372 } |
377 } |
373 return; |
378 return; |
374 } |
379 } |
375 case FmErrDisMounted: // Caused by eject MMC when preparing backup, will be localized later |
380 case FmErrDisMounted: // Caused by eject MMC when preparing backup, will be localized later |
376 FmDlgUtils::information( QString( hbTrId("Operation failed because backup target drive has been removed!") ) ); |
381 FmDlgUtils::warning( QString( hbTrId("Operation failed because backup target drive has been removed!") ) ); |
377 return; |
382 return; |
378 case FmErrDiskFull: |
383 case FmErrDiskFull: |
379 FmDlgUtils::information( QString( hbTrId("Not enough space. Operation cancelled!")) ); |
384 FmDlgUtils::warning( QString( hbTrId("Not enough space. Operation cancelled!")) ); |
380 return; |
385 return; |
381 case FmErrCopyDestToSubFolderInSrc: |
386 case FmErrCopyDestToSubFolderInSrc: |
382 FmDlgUtils::information( QString( hbTrId("Can not copy to sub folder!")) ); |
387 FmDlgUtils::warning( QString( hbTrId("Can not copy to sub folder!")) ); |
383 return; |
388 return; |
384 case FmErrMoveDestToSubFolderInSrc: |
389 case FmErrMoveDestToSubFolderInSrc: |
385 FmDlgUtils::information( QString( hbTrId("Can not move to sub folder!")) ); |
390 FmDlgUtils::warning( QString( hbTrId("Can not move to sub folder!")) ); |
386 return; |
391 return; |
387 case FmErrCannotRemove:{ |
392 case FmErrCannotRemove:{ |
388 if( operationBase->operationType() == FmOperationService::EOperationTypeCopy ) { |
393 if( operationBase->operationType() == FmOperationService::EOperationTypeCopy ) { |
389 // when copy a file/dir to same name destination, and delete dest fail, this error will occur |
394 // when copy a file/dir to same name destination, and delete dest fail, this error will occur |
390 FmDlgUtils::information( QString( hbTrId( "Can not copy because %1 can not be deleted!" ).arg( errString ) ) ); |
395 FmDlgUtils::warning( QString( hbTrId( "Can not copy because %1 can not be deleted!" ).arg( errString ) ) ); |
391 return; |
396 return; |
392 } |
397 } |
393 else if( operationBase->operationType() == FmOperationService::EOperationTypeMove ) { |
398 else if( operationBase->operationType() == FmOperationService::EOperationTypeMove ) { |
394 // when move a file/dir to same name destination, and delete dest fail, this error will occur |
399 // when move a file/dir to same name destination, and delete dest fail, this error will occur |
395 FmDlgUtils::information( QString( hbTrId( "Can not move because %1 can not be deleted!" ).arg( errString ) ) ); |
400 FmDlgUtils::warning( QString( hbTrId( "Can not move because %1 can not be deleted!" ).arg( errString ) ) ); |
396 return; |
401 return; |
397 } |
402 } |
398 // when delete file/dir fail, this error will occur |
403 // when delete file/dir fail, this error will occur |
399 FmDlgUtils::information( QString( hbTrId( "Can not delete %1!" ).arg( errString ) ) ); |
404 FmDlgUtils::warning( QString( hbTrId( "Can not delete %1!" ).arg( errString ) ) ); |
400 return; |
405 return; |
401 } |
406 } |
402 case FmErrRemoveDefaultFolder:{ |
407 case FmErrRemoveDefaultFolder:{ |
403 if( operationBase->operationType() == FmOperationService::EOperationTypeMove ) { |
408 if( operationBase->operationType() == FmOperationService::EOperationTypeMove ) { |
404 // when move a default folder |
409 // when move a default folder |
405 FmDlgUtils::information( QString( hbTrId( "Could not move because the default folder %1 can not be deleted!" ).arg( errString ) ) ); |
410 FmDlgUtils::warning( QString( hbTrId( "Could not move because the default folder %1 can not be deleted!" ).arg( errString ) ) ); |
406 return; |
411 return; |
407 } |
412 } |
408 else { |
413 else { |
409 // when delete the default folder |
414 // when delete the default folder |
410 FmDlgUtils::information( QString( hbTrId( "Could not remove the default folder %1 " ).arg( errString ) ) ); |
415 FmDlgUtils::warning( QString( hbTrId( "Could not remove the default folder %1 " ).arg( errString ) ) ); |
411 return; |
416 return; |
412 } |
417 } |
413 } |
418 } |
414 } |
419 } |
415 |
420 |
416 switch( operationBase->operationType() ) |
421 switch( operationBase->operationType() ) |
417 { |
422 { |
418 case FmOperationService::EOperationTypeFormat: |
423 case FmOperationService::EOperationTypeFormat: |
419 FmDlgUtils::information( QString( hbTrId("Format failed!")) ); |
424 FmDlgUtils::warning( QString( hbTrId("Format failed!")) ); |
420 break; |
425 break; |
421 default: |
426 default: |
422 FmDlgUtils::information( QString( hbTrId("Operation failed")) ); |
427 FmDlgUtils::warning( QString( hbTrId("Operation failed")) ); |
423 } |
428 } |
424 |
429 |
425 } |
430 } |
426 |
431 |
427 /* |
432 /* |