filemanager/src/filemanager/src/fmfilebrowsewidget.cpp
changeset 21 15299bc55001
parent 18 edd66bde63a4
child 24 1d0c87b42e2e
--- a/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp	Fri May 14 15:42:43 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp	Thu May 27 12:45:43 2010 +0300
@@ -694,10 +694,11 @@
 {
     QString filePath = mModel->filePath( mCurrentItem->modelIndex() );
     QFileInfo fileInfo = mModel->fileInfo( mCurrentItem->modelIndex() );
-
+    int maxFileNameLength = FmUtils::getMaxFileNameLength();
+    
     QString newName( fileInfo.fileName() );
-    
-    while( FmDlgUtils::showTextQuery( hbTrId( "Enter new name for %1" ).arg( newName ), newName, true ) ){
+    while( FmDlgUtils::showTextQuery( hbTrId( "Enter new name for %1" ).arg( newName ), newName, true,
+            maxFileNameLength, QString() , false ) ){
         QString newTargetPath = FmUtils::fillPathWithSplash(
             fileInfo.absolutePath() ) + newName;
         QFileInfo newFileInfo( newTargetPath );
@@ -705,7 +706,14 @@
             HbMessageBox::information( hbTrId( "%1 already exist!" ).arg( newName ) );
             continue;
         }
-
+        if( !FmUtils::checkFolderFileName( newName ) ) {
+            HbMessageBox::information( hbTrId( "Invalid file or folder name, try again!" ) );
+            continue;
+        }
+        if( !FmUtils::checkMaxPathLength( newTargetPath ) ) {
+            HbMessageBox::information( hbTrId( "the path you specified is too long, try again!" ) );
+            continue;
+        }
         if( !rename( fileInfo.absoluteFilePath(), newTargetPath ) ) {
             HbMessageBox::information( hbTrId("Rename failed!") );
         }