filemanager/src/filemanager/src/fmfilebrowsewidget.cpp
changeset 29 b3155376f2b4
parent 24 1d0c87b42e2e
child 30 6e96d2143d46
--- a/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp	Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp	Wed Jun 23 18:03:11 2010 +0300
@@ -688,10 +688,12 @@
     QString filePath = mModel->filePath( mCurrentItem->modelIndex() );
     QFileInfo fileInfo = mModel->fileInfo( mCurrentItem->modelIndex() );
     int maxFileNameLength = FmUtils::getMaxFileNameLength();
-    
+    QString oldSuffix( fileInfo.suffix() );
     QString newName( fileInfo.fileName() );
     while( FmDlgUtils::showTextQuery( hbTrId( "Enter new name for %1" ).arg( newName ), newName, true,
             maxFileNameLength, QString() , true ) ){
+        // remove whitespace from the start and the end.
+        newName = newName.trimmed();
         QString newTargetPath = FmUtils::fillPathWithSplash(
             fileInfo.absolutePath() ) + newName;
         QFileInfo newFileInfo( newTargetPath );
@@ -711,6 +713,12 @@
         if( !rename( fileInfo.absoluteFilePath(), newTargetPath ) ) {
             FmDlgUtils::information( hbTrId("Rename failed!") );
         }
+        else {
+            QString newSuffix( newFileInfo.suffix() );
+            if ( oldSuffix != newSuffix ) {
+                FmDlgUtils::information( hbTrId( "File may become unusable when file name extension is changed" ) );        
+            }   
+        }
         break;
-    }   
+    }
 }