394 { |
394 { |
395 int maxFileNameLength = FmUtils::getMaxFileNameLength(); |
395 int maxFileNameLength = FmUtils::getMaxFileNameLength(); |
396 QString associatedDrive = FmUtils::getDriveLetterFromPath( mWidget->currentPath().absoluteFilePath() ); |
396 QString associatedDrive = FmUtils::getDriveLetterFromPath( mWidget->currentPath().absoluteFilePath() ); |
397 QString path = FmUtils::fillPathWithSplash( mWidget->currentPath().absoluteFilePath() ); |
397 QString path = FmUtils::fillPathWithSplash( mWidget->currentPath().absoluteFilePath() ); |
398 QString dirName = createDefaultFolderName( path ); |
398 QString dirName = createDefaultFolderName( path ); |
399 |
399 QStringList regExpList = (QStringList() << Regex_ValidFileFolderName << Regex_ValidNotEndWithDot ); |
|
400 |
400 QDir dir( path ); |
401 QDir dir( path ); |
401 if( dir.exists() ) { |
402 if( dir.exists() ) { |
402 while( FmDlgUtils::showTextQuery( hbTrId( "txt_fmgr_title_new_folder" ), dirName, |
403 while( FmDlgUtils::showTextQuery( hbTrId( "txt_fmgr_title_new_folder" ), dirName, |
403 true, maxFileNameLength, associatedDrive , false ) ){ |
404 regExpList, maxFileNameLength, associatedDrive , false ) ){ |
404 // remove whitespace from the start and the end. |
405 // remove whitespace from the start and the end. |
405 dirName = dirName.trimmed(); |
406 dirName = dirName.trimmed(); |
406 QString newTargetPath = FmUtils::fillPathWithSplash( |
407 QString newTargetPath = FmUtils::fillPathWithSplash( |
407 dir.absolutePath() ) + dirName; |
408 dir.absolutePath() ) + dirName; |
408 QString errString; |
409 QString errString; |
409 // check if name/path is available for use |
410 // check if name/path is available for use |
410 if( !FmUtils::checkNewFolderOrFile( newTargetPath, errString ) ) { |
411 if( !FmUtils::checkNewFolderOrFile( dirName, newTargetPath, errString ) ) { |
411 FmDlgUtils::information( errString ); |
412 FmDlgUtils::information( errString ); |
412 continue; |
413 continue; |
413 } |
414 } |
414 if( !dir.mkdir( dirName ) ) { |
415 if( !dir.mkdir( dirName ) ) { |
415 FmDlgUtils::information( hbTrId("Operation failed!") ); |
416 FmDlgUtils::information( hbTrId("Operation failed!") ); |