filemanager/src/filemanager/src/fmfileview.cpp
changeset 35 060d0b1ab845
parent 30 6e96d2143d46
child 44 22e202702210
--- a/filemanager/src/filemanager/src/fmfileview.cpp	Tue Jul 06 14:06:28 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfileview.cpp	Wed Aug 18 09:39:39 2010 +0300
@@ -39,7 +39,7 @@
 
 FmFileView::FmFileView() : FmViewBase( EFileView ), mWidget( 0 ),
     mUpButton( 0 ), mStyleAction( 0 ), mSelectableAction( 0 ),
-    mFindAction( 0 ), mOperationService( 0 ), mMenu( 0 ) 
+    mFindAction( 0 ), mOperationService( 0 ), mMenu( 0 ), mIsFindDisabled( false )
 {
     mOperationService = FmViewManager::viewManager()->operationService();
 	initMenu();
@@ -93,8 +93,9 @@
 
 void FmFileView::setFindDisabled( bool disable )
 {
+    mIsFindDisabled = disable;
     if( mFindAction ) {
-        mFindAction->setDisabled( disable );
+        mFindAction->setDisabled( mIsFindDisabled );
     }
 }
 
@@ -212,6 +213,7 @@
     mFindAction = new HbAction( this );
     mFindAction->setObjectName( "leftAction" );
     mFindAction->setText( hbTrId("txt_fmgr_opt_find") );
+    mFindAction->setDisabled( mIsFindDisabled );
     toolBar()->addAction( mFindAction );
 
     mToolBarRightAction = new HbAction( this );
@@ -396,25 +398,25 @@
     QString associatedDrive = FmUtils::getDriveLetterFromPath( mWidget->currentPath().absoluteFilePath() );
     QString path = FmUtils::fillPathWithSplash( mWidget->currentPath().absoluteFilePath() );
     QString dirName = createDefaultFolderName( path );
-    
+    QStringList regExpList = (QStringList() << Regex_ValidFileFolderName << Regex_ValidNotEndWithDot );
+
     QDir dir( path );  
     if( dir.exists() ) {
         while( FmDlgUtils::showTextQuery( hbTrId( "txt_fmgr_title_new_folder" ), dirName,
-            true, maxFileNameLength, associatedDrive , false ) ){
+            regExpList, maxFileNameLength, associatedDrive , false ) ){
             // remove whitespace from the start and the end.
             dirName = dirName.trimmed();
             QString newTargetPath = FmUtils::fillPathWithSplash(
                 dir.absolutePath() ) + dirName;
             QString errString;
             // check if name/path is available for use
-            if( !FmUtils::checkNewFolderOrFile( newTargetPath, errString ) ) {
+            if( !FmUtils::checkNewFolderOrFile( dirName, newTargetPath, errString ) ) {
                 FmDlgUtils::information( errString );
                 continue;
             }
             if( !dir.mkdir( dirName ) ) {
                 FmDlgUtils::information( hbTrId("Operation failed!") );
             }
-            refreshModel( path );
             break;
         }
         
@@ -444,9 +446,9 @@
 	}
 }
 
-void FmFileView::refreshModel( const QString &path )
+void FmFileView::on_driveChanged()
 {
-    mWidget->refreshModel( path );  
+    mWidget->on_driveChanged();  
 }
 
 void FmFileView::on_sortNameAction_triggered()
@@ -484,14 +486,14 @@
 void FmFileView::on_mainWidget_setEmptyMenu( bool isMenuEmpty )
 {
     if( isMenuEmpty ){
-        FmLogger::log( "setEmptyMenu true" );
+        FM_LOG( "setEmptyMenu true" );
         if( !mMenu ) {
             mMenu = takeMenu();
         }
         toolBar()->clearActions();
     }
     else {
-        FmLogger::log( "setEmptyMenu false" );
+        FM_LOG( "setEmptyMenu false" );
         if( mMenu ) {
             setMenu( mMenu );
             mMenu = 0;