diff -r 15bc28c9dd51 -r d58987eac7e8 filemanager/src/filemanager/src/fmfilebrowsewidget.cpp --- a/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Tue Aug 24 10:24:14 2010 +0800 +++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Wed Sep 29 10:37:03 2010 +0800 @@ -24,7 +24,9 @@ #include "fmviewmanager.h" #include "fmfiledialog.h" #include "fmdlgutils.h" +#include "fmserviceutils.h" #include "fmfileiconprovider.h" +#include "fmfilesystemproxymodel.h" #include #include @@ -79,6 +81,7 @@ mTreeView->setModel( 0 ); mListView->setModel( 0 ); + delete mSourceModel; delete mModel; delete mFileIconProvider; @@ -133,7 +136,7 @@ } case FmErrPathNotExist: { - FmDlgUtils::information( hbTrId( "Path is not exist" ) ); + FmDlgUtils::warning( hbTrId( "Path is not exist" ) ); break; } case FmErrDriveNotAvailable: @@ -144,7 +147,7 @@ case FmErrDriveDenied: case FmErrPathDenied: { - FmDlgUtils::information( hbTrId( "Can not access" ) ); + FmDlgUtils::warning( hbTrId( "Can not access" ) ); break; } default: @@ -335,16 +338,18 @@ this, SLOT( on_renameAction_triggered() ), Qt::QueuedConnection ); } -// if( fileInfo.isFile() ){ -// HbAction *sendAction = new HbAction(); -// sendAction->setObjectName( "sendAction" ); -// sendAction->setText( hbTrId( "txt_fmgr_menu_send" ) ); -// contextMenu->addAction( sendAction ); -// -// connect( sendAction, SIGNAL( triggered() ), -// this, SLOT( on_sendAction_triggered() ) ); -// } + if( fileInfo.isFile() ){ + HbAction *sendAction = new HbAction(); + sendAction->setObjectName( "sendAction" ); + sendAction->setText( hbTrId( "txt_fmgr_menu_send" ) ); + contextMenu->addAction( sendAction ); + + connect( sendAction, SIGNAL( triggered() ), + this, SLOT( on_sendAction_triggered() ), Qt::QueuedConnection ); + } + // delete itself when close + contextMenu->setAttribute(Qt::WA_DeleteOnClose); contextMenu->setPreferredPos( coords ); contextMenu->open(); } @@ -408,11 +413,15 @@ void FmFileBrowseWidget::initFileModel() { - mModel = new QFileSystemModel( this ); - mModel->setReadOnly( false ); + mSourceModel = new QFileSystemModel( this ); + mSourceModel->setReadOnly( false ); mFileIconProvider = new FmFileIconProvider(); - mModel->setIconProvider( mFileIconProvider ); + mSourceModel->setIconProvider( mFileIconProvider ); + + mModel = new FmFileSystemProxyModel( this ); + mModel->setSourceModel( mSourceModel ); + } void FmFileBrowseWidget::initLayout() @@ -427,15 +436,12 @@ { mSearchPanel = new HbSearchPanel( this ); mSearchPanel->setObjectName( "searchPanel" ); - mSearchPanel->setSearchOptionsEnabled( true ); - mSearchPanel->setProgressive( false ); + mSearchPanel->setSearchOptionsEnabled( false ); + mSearchPanel->setProgressive( true ); mSearchPanel->hide(); - connect( mSearchPanel, SIGNAL( searchOptionsClicked() ), - this, SLOT( on_searchPanel_searchOptionsClicked() ), Qt::QueuedConnection ); - - connect( mSearchPanel, SIGNAL( criteriaChanged( const QString & ) ), - this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ) ); + connect( mSearchPanel, SIGNAL( criteriaChanged( QString ) ), + this, SLOT( on_searchPanel_criteriaChanged( QString ) ), Qt::QueuedConnection ); connect( mSearchPanel, SIGNAL( exitClicked() ), this, SLOT( on_searchPanel_exitClicked() ) ); @@ -572,21 +578,16 @@ mSearchPanel->show(); } -void FmFileBrowseWidget::on_searchPanel_searchOptionsClicked() -{ - mFindTargetPath = FmUtils::fillPathWithSplash( FmFileDialog::getExistingDirectory( 0, hbTrId( "Look in:" ), QString(""), - QStringList() ) ); -} - void FmFileBrowseWidget::on_searchPanel_criteriaChanged( const QString &criteria ) { - if( mFindTargetPath.isEmpty() ){ - mFindTargetPath = currentPath().filePath(); - } - emit startSearch( mFindTargetPath, criteria ); - + emit startSearch( criteria ); mSearchPanel->hide(); mLayout->removeItem( mSearchPanel ); + + // clear keywords in searchpanel without signal criteriaChanged triggered again + mSearchPanel->setProgressive( false ); + mSearchPanel->setCriteria( QString() ); + mSearchPanel->setProgressive( true ); } void FmFileBrowseWidget::on_searchPanel_exitClicked() @@ -600,7 +601,7 @@ QString filePath = mModel->filePath( mCurrentItem->modelIndex() ); QStringList list; list.append( filePath ); - FmUtils::sendFiles( list ); + FmViewManager::viewManager()->serviceUtils()->sendFile( list ); } void FmFileBrowseWidget::on_viewAction_triggered() @@ -628,13 +629,13 @@ break; case FmErrAlreadyStarted: // last operation have not finished - FmDlgUtils::information( hbTrId( "Operatin already started!" ) ); + FmDlgUtils::warning( hbTrId( "Operatin already started!" ) ); break; case FmErrWrongParam: - FmDlgUtils::information( hbTrId( "Wrong parameters!" ) ); + FmDlgUtils::warning( hbTrId( "Wrong parameters!" ) ); break; default: - FmDlgUtils::information( hbTrId( "Operation fail to start!" ) ); + FmDlgUtils::warning( hbTrId( "Operation fail to start!" ) ); } } } @@ -657,13 +658,13 @@ break; case FmErrAlreadyStarted: // last operation have not finished - FmDlgUtils::information( hbTrId( "Operatin already started!" ) ); + FmDlgUtils::warning( hbTrId( "Operatin already started!" ) ); break; case FmErrWrongParam: - FmDlgUtils::information( hbTrId( "Wrong parameters!" ) ); + FmDlgUtils::warning( hbTrId( "Wrong parameters!" ) ); break; default: - FmDlgUtils::information( hbTrId( "Operation fail to start!" ) ); + FmDlgUtils::warning( hbTrId( "Operation fail to start!" ) ); } } @@ -687,13 +688,13 @@ break; case FmErrAlreadyStarted: // last operation have not finished - FmDlgUtils::information( hbTrId( "Operatin already started!" ) ); + FmDlgUtils::warning( hbTrId( "Operatin already started!" ) ); break; case FmErrWrongParam: - FmDlgUtils::information( hbTrId( "Wrong parameters!" ) ); + FmDlgUtils::warning( hbTrId( "Wrong parameters!" ) ); break; default: - FmDlgUtils::information( hbTrId( "Operation fail to start!" ) ); + FmDlgUtils::warning( hbTrId( "Operation fail to start!" ) ); } } } @@ -720,11 +721,11 @@ // check if name/path is available for use // add new Name to check, in order to avoid problem of newName is empty if( !FmUtils::checkNewFolderOrFile( newName, newTargetPath, errString ) ) { - FmDlgUtils::information( errString ); + FmDlgUtils::warning( errString, HbMessageBox::Ok, true ); continue; } if( !rename( fileInfo.absoluteFilePath(), newTargetPath ) ) { - FmDlgUtils::information( hbTrId("Rename failed!") ); + FmDlgUtils::warning( hbTrId("Rename failed!") ); } else { // Rename succeed