# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1284701262 -10800 # Node ID 22e202702210ebd112ba1abb8c31e3d39034d0cf # Parent fc4654ce4fcb1f20dcf7f19f7acf8aefe1894ab0 Revision: 201035 Kit: 201037 diff -r fc4654ce4fcb -r 22e202702210 filemanager/rom/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/rom/bld.inf Fri Sep 17 08:27:42 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Rom exports for FileManager +* +*/ + + +#include + + + +#include +filemngr.iby CORE_APP_LAYER_IBY_EXPORT_PATH(filemngr.iby) +filemngr_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(filemngr_resources.iby) diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/burconfig.xml --- a/filemanager/src/filemanager/burconfig.xml Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/burconfig.xml Fri Sep 17 08:27:42 2010 +0300 @@ -54,7 +54,7 @@ 0x2001FE79 0x2002A542 0x10003a73 - 0x101f4cce + 0x20022EF9 0x10003a5b 0x10005901 0x10008d38 @@ -86,7 +86,7 @@ EBUCatSpecNone EBUCatSpecNone 0x10003a73 - 0x101f4cce + 0x20022EF9 diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp --- a/filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp Fri Sep 17 08:27:42 2010 +0300 @@ -36,13 +36,21 @@ QStringList dataPathList; dataPathList.append( QString( FmViewDetail_Contacts ) ); - FmDriveDetailsDataGroup driveDetailsDataGroup( FmDriveDetailsSize::ETypeContacts, dataPathList ); + FmDriveDetailsDataGroup driveDetailsDataGroupForContacts( FmDriveDetailsSize::ETypeContacts, dataPathList ); - err = getDataSizeByAbsolutePath(driveName, driveDetailsDataGroup, detailsSizeList, isStopped); + err = getDataSizeByAbsolutePath(driveName, driveDetailsDataGroupForContacts, detailsSizeList, isStopped); if( err != FmErrNone ) { return err; } + dataPathList.clear(); + dataPathList.append( QString( FmViewDetail_Messages ) ); + FmDriveDetailsDataGroup driveDetailsDataGroupForMessage( FmDriveDetailsSize::ETypeMessages, dataPathList ); + + err = getDataSizeByAbsolutePath(driveName, driveDetailsDataGroupForMessage, detailsSizeList, isStopped); + if( err != FmErrNone ) { + return err; + } return FmErrNone; } int FmDriveDetailsContent::getDataSizeByTraversePath( const QString &driveName, @@ -134,7 +142,30 @@ QString driver(FmUtils::removePathSplash(FmUtils::getDriveNameFromPath(driveName))); QFileInfo fileInfo(QString(driver + (*it))); if (fileInfo.exists()) { - totalSize += fileInfo.size(); + if (fileInfo.isFile()) { + totalSize += fileInfo.size(); + } else if (fileInfo.isDir()) { + QList dirs; + dirs.append(QDir(fileInfo.absolutePath())); + // traverse the whole path + while (!dirs.isEmpty()) { + QDir::Filters filter = QDir::NoDotAndDotDot | QDir::AllEntries; + QFileInfoList infoList = dirs.first().entryInfoList( filter ); + for ( QFileInfoList::const_iterator it = infoList.begin(); it != infoList.end(); ++it ) { + if ( *isStopped ){ + return FmErrCancel; + } + if ( it->isFile() ) { + totalSize += it->size(); + } + else if ( it->isDir() ) { + dirs.append( QDir( it->absoluteFilePath() ) ); + } + } + dirs.removeFirst(); + } + } + } } diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/components/fmdrivedetailstype.h --- a/filemanager/src/filemanager/src/components/fmdrivedetailstype.h Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmdrivedetailstype.h Fri Sep 17 08:27:42 2010 +0300 @@ -148,7 +148,8 @@ QList &detailsSizeList, volatile bool *isStopped ); /*! - Gets data size for single FmDriveDetailsDataGroup, the method is find file of absolute path + Gets data size for single FmDriveDetailsDataGroup + The method will find file or traverse all folders of absolute path \a driveName which drive is searching \a dataGroup which dataGroup is searching, for example, EGroupContacts... \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp --- a/filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp Fri Sep 17 08:27:42 2010 +0300 @@ -43,7 +43,8 @@ mSizeofNativeFiles( 0 ), mSizeofDocument( 0 ), mSizeofCalendar( 0 ), - mSizeofContacts( 0 ) + mSizeofContacts( 0 ), + mSizeofMessages( 0 ) { init(); @@ -169,6 +170,13 @@ sizeOfOthers -= mSizeofContacts; dataList.clear(); + dataList << hbTrId ( "Messages:" ); + dataList << FmUtils::formatStorageSize( mSizeofMessages ); + mDataListModel->setData( mDataListModel->index( EMemoryMessages, 0 ), dataList, Qt::DisplayRole ); + + sizeOfOthers -= mSizeofMessages; + + dataList.clear(); dataList << hbTrId ( "Others:" ); dataList << FmUtils::formatStorageSize( sizeOfOthers ); mDataListModel->setData( mDataListModel->index( EMemoryOthers, 0 ), dataList, Qt::DisplayRole ); @@ -288,6 +296,7 @@ mSizeofDocument = 0; mSizeofCalendar = 0; mSizeofContacts = 0; + mSizeofMessages = 0; for( QList< FmDriveDetailsSize* >::const_iterator it = detailsSizeList.begin(); it!= detailsSizeList.end(); ++it ){ @@ -333,6 +342,11 @@ mSizeofContacts = ( *it )->size(); break; } + case FmDriveDetailsSize::ETypeMessages: + { + mSizeofMessages = ( *it )->size(); + break; + } default: break; } diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/components/fmviewdetailsdialog.h --- a/filemanager/src/filemanager/src/components/fmviewdetailsdialog.h Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmviewdetailsdialog.h Fri Sep 17 08:27:42 2010 +0300 @@ -45,6 +45,7 @@ EMemoryDocuments, EMemoryCalendar, EMemoryContacts, + EMemoryMessages, EMemoryOthers, EDriveDetailEntryEnd }; @@ -109,6 +110,7 @@ quint64 mSizeofDocument; quint64 mSizeofCalendar; quint64 mSizeofContacts; + quint64 mSizeofMessages; }; #endif /* FMVIEWDETAILSDIALOG_H_ */ diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmdriverlistwidget.cpp --- a/filemanager/src/filemanager/src/fmdriverlistwidget.cpp Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmdriverlistwidget.cpp Fri Sep 17 08:27:42 2010 +0300 @@ -79,8 +79,8 @@ mLayout->addItem( mListView ); mSearchPanel = new HbSearchPanel( this ); mSearchPanel->setObjectName( "searchPanel" ); - mSearchPanel->setSearchOptionsEnabled( true ); - mSearchPanel->setProgressive( false ); + mSearchPanel->setSearchOptionsEnabled( false ); + mSearchPanel->setProgressive( true ); mSearchPanel->hide(); connect( mListView, SIGNAL( activated( const QModelIndex & ) ), this, SLOT( on_list_activated( const QModelIndex & ) ) ); @@ -90,11 +90,8 @@ connect( mListView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ), this, SLOT( on_list_longPressed( HbAbstractViewItem *, const QPointF & ) ) ); - connect( mSearchPanel, SIGNAL( searchOptionsClicked() ), - this, SLOT( on_searchPanel_searchOptionsClicked() ), Qt::QueuedConnection ); - connect( mSearchPanel, SIGNAL( criteriaChanged( const QString & ) ), - this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ) ); + this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ), Qt::QueuedConnection ); connect( mSearchPanel, SIGNAL( exitClicked() ), this, SLOT( on_searchPanel_exitClicked() ) ); @@ -425,31 +422,21 @@ void FmDriverListWidget::activeSearchPanel() { - QStringList driveList; - FmUtils::getDriveList( driveList, true ); - if(driveList.count() > 0 ) { - mFindTargetPath = driveList.first(); - if( FmUtils::isDriveC( mFindTargetPath ) ) { - mFindTargetPath = QString( Folder_C_Data ); - } - } else { - mFindTargetPath.clear(); - } mLayout->addItem( mSearchPanel ); mSearchPanel->show(); } -void FmDriverListWidget::on_searchPanel_searchOptionsClicked() -{ - mFindTargetPath = FmUtils::fillPathWithSplash( FmFileDialog::getExistingDirectory( 0, hbTrId( "Look in:" ), - QString(""), QStringList() ) ); -} - void FmDriverListWidget::on_searchPanel_criteriaChanged( const QString &criteria ) { - 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 FmDriverListWidget::on_searchPanel_exitClicked() diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmdriverlistwidget.h --- a/filemanager/src/filemanager/src/fmdriverlistwidget.h Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmdriverlistwidget.h Fri Sep 17 08:27:42 2010 +0300 @@ -45,7 +45,7 @@ signals: void activated( const QString &path ); - void startSearch( const QString &targetPath, const QString &criteria ); + void startSearch( const QString &criteria ); private slots: void on_list_activated( const QModelIndex &index ); @@ -63,7 +63,6 @@ void on_ejectAction_triggered(); void on_directoryChanged( const QString &path ); - void on_searchPanel_searchOptionsClicked(); void on_searchPanel_criteriaChanged( const QString &criteria ); void on_searchPanel_exitClicked(); private: @@ -77,7 +76,6 @@ QFileSystemWatcher *mFileSystemWatcher; - QString mFindTargetPath; QGraphicsLinearLayout *mLayout; HbMenu *mContextMenu; diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmdriverview.cpp --- a/filemanager/src/filemanager/src/fmdriverview.cpp Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmdriverview.cpp Fri Sep 17 08:27:42 2010 +0300 @@ -20,7 +20,9 @@ #include "fmdriverlistwidget.h" #include "fmviewmanager.h" #include "fmcommon.h" +#include "fmutils.h" +#include #include #include @@ -80,11 +82,11 @@ void FmDriverView::initDiskListWidget() { mDriverList = new FmDriverListWidget( this ); - connect( mDriverList, SIGNAL( activated( const QString& ) ), - this, SLOT( activated( const QString& ) ), Qt::QueuedConnection ); + connect( mDriverList, SIGNAL( activated( QString ) ), + this, SLOT( activated( QString ) ), Qt::QueuedConnection ); - connect( mDriverList, SIGNAL( startSearch( const QString&, const QString& ) ), - this, SLOT( startSearch( const QString&, const QString& ) ) ); + connect( mDriverList, SIGNAL( startSearch( QString ) ), + this, SLOT( startSearch( QString ) ) ); setWidget( mDriverList ); } @@ -158,10 +160,22 @@ mDriverList->activeSearchPanel(); } -void FmDriverView::startSearch( const QString &targetPath, const QString &criteria ) +void FmDriverView::startSearch( const QString &criteria ) { - if ( !criteria.isEmpty() && !targetPath.isEmpty() ) { - FmViewManager::viewManager()->createFindView( criteria, targetPath ); + // search all drives when start find in drive view + QStringList findTargetPathList; + QStringList driveList; + FmUtils::getDriveList( driveList, true ); + foreach( const QString &drive, driveList ) { + QString targetPath = FmUtils::fillPathWithSplash( drive ); + if( FmUtils::isDriveC( targetPath ) ) { + targetPath = QString( Folder_C_Data ); + } + findTargetPathList.append( targetPath ); + } + + if ( !criteria.isEmpty() ) { + FmViewManager::viewManager()->createFindView( criteria, findTargetPathList ); } } diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmdriverview.h --- a/filemanager/src/filemanager/src/fmdriverview.h Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmdriverview.h Fri Sep 17 08:27:42 2010 +0300 @@ -44,7 +44,7 @@ void activated( const QString &pathName ); void refreshDrive(); - void startSearch( const QString &targetPath, const QString &criteria ); + void startSearch( const QString &criteria ); #ifdef FM_CHANGE_ORIENT_ENABLE void on_rotateAction_triggered(); diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmfilebrowsewidget.cpp --- a/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Fri Sep 17 08:27:42 2010 +0300 @@ -39,6 +39,8 @@ #include #include +#include + // These define comes from implementation of QFileSystemModel #define QFileSystemSortName 0 #define QFileSystemSortSize 1 @@ -335,16 +337,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(); } @@ -427,15 +431,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 +573,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 +596,7 @@ QString filePath = mModel->filePath( mCurrentItem->modelIndex() ); QStringList list; list.append( filePath ); - FmUtils::sendFiles( list ); + FmViewManager::viewManager()->shareUi()->send( list, true ); } void FmFileBrowseWidget::on_viewAction_triggered() diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmfilebrowsewidget.h --- a/filemanager/src/filemanager/src/fmfilebrowsewidget.h Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.h Fri Sep 17 08:27:42 2010 +0300 @@ -82,13 +82,12 @@ // triggered when drive is ejected/inserted void on_driveChanged(); - void on_searchPanel_searchOptionsClicked(); void on_searchPanel_criteriaChanged( const QString &criteria ); void on_searchPanel_exitClicked(); signals: void currentPathChanged( const QString& ); - void startSearch( const QString &targetPath, const QString &criteria ); + void startSearch( const QString &criteria ); void setEmptyMenu( bool isMenuEmpty ); void setTitle( const QString &title ); void listActivated(); diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmfileview.cpp --- a/filemanager/src/filemanager/src/fmfileview.cpp Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfileview.cpp Fri Sep 17 08:27:42 2010 +0300 @@ -199,12 +199,12 @@ setLayout( vLayout ); - connect( mWidget, SIGNAL( startSearch( const QString&, const QString& ) ), - this, SLOT( startSearch( const QString&, const QString& ) ) ); + connect( mWidget, SIGNAL( startSearch( QString ) ), + this, SLOT( startSearch( QString ) ) ); connect( mWidget, SIGNAL( setEmptyMenu( bool ) ), this, SLOT( on_mainWidget_setEmptyMenu( bool ) ) ); - connect( mWidget, SIGNAL( setTitle( const QString & ) ), - this, SLOT( on_mainWidget_setTitle( const QString & ) ) ); + connect( mWidget, SIGNAL( setTitle( QString ) ), + this, SLOT( on_mainWidget_setTitle( QString ) ) ); } void FmFileView::initToolBar() @@ -471,10 +471,11 @@ mWidget->sortFiles( FmFileBrowseWidget::ESortByType ); } -void FmFileView::startSearch( const QString &targetPath, const QString &criteria ) +void FmFileView::startSearch( const QString &criteria ) { - if ( !criteria.isEmpty() && !targetPath.isEmpty() ) { - FmViewManager::viewManager()->createFindView( criteria, targetPath ); + if ( !criteria.isEmpty() ) { + QString targetPath( mWidget->currentPath().filePath() ); + FmViewManager::viewManager()->createFindView( criteria, QStringList()< #include +// wait \a circularWaitingTimeForStartFind microsecond to try to start find again +// Since find can not be started while last find is not stopped. +const int circularWaitingTimeForStartFind = 200; + +// wait \a firstWaitingTimeForStartFind microsecond to start find when accept find from caller. +// Means user can continuously input words for search, so that find will not immediately start after accept each input event. +// Search will be started after \a firstWaitingTimeForStartFind time of last user input +const int firstWaitingTimeForStartFind = 750; + /*! \fn void finished() This signal is emitted when find is finished. @@ -39,14 +49,92 @@ FmFindResultModel::FmFindResultModel( QObject *parent ) : QAbstractListModel( parent ) { + FM_LOG("FmFindResultModel::FmFindResultModel"); init(); - connect( mFindThread, SIGNAL(finished()), this, SIGNAL(finished()) ); + connect( mFindThread, SIGNAL( finished()), this, SLOT(onThreadFinished()) ); connect( mFindThread, SIGNAL(found(QStringList)), this, SLOT(on_findThread_found( QStringList) ), Qt::BlockingQueuedConnection ); + connect( &mTimer, SIGNAL(timeout()), this, SLOT(startFind())); } FmFindResultModel::~FmFindResultModel() { + FM_LOG("FmFindResultModel::~FmFindResultModel START"); + mFindThread->stop(); + if( mFindThread->isRunning() ) { + mStopEventLoop.exec(); + } delete mIconProvider; + FM_LOG("FmFindResultModel::~FmFindResultModel END"); +} + +/*! + Send find \a regExp and \a pathList to find queue + last un-stopped find will be stopped and start new find in 0 - 2 seconeds. +*/ +void FmFindResultModel::find( const QRegExp ®Exp, const QStringList &pathList ) +{ + mFindPath = pathList; + mRegExp = regExp; + + mTimer.stop(); + + if (mFindThread->isRunning()) { + mFindThread->stop(); + } + mTimer.start( firstWaitingTimeForStartFind ); +} + +/*! + Internal start entrance, will be triggered by timer + Wait till last find stopped and start new find. +*/ +void FmFindResultModel::startFind() +{ + mTimer.stop(); + if (mFindThread->isRunning()) { + mFindThread->stop(); + mTimer.start( circularWaitingTimeForStartFind ); + return; + } + + // Find starting. Initialize context. + mFindThread->setFindPathList( mFindPath ); + mFindThread->setPattern( mRegExp ); + removeRows( 0, rowCount() ); + emit findStarted(); + mFindThread->start(); +} + +/*! + Return if find is inprogress +*/ +bool FmFindResultModel::isFinding() const +{ + return mFindThread->isRunning(); +} + +/*! + Stop find +*/ +void FmFindResultModel::stopFind() +{ + mFindThread->stop(); + if( mFindThread->isRunning() ) { + mStopEventLoop.exec(); + } +} + +/* + Find finish slot. +*/ +void FmFindResultModel::onThreadFinished() +{ + FM_LOG("FmFindResultModel::onThreadFinished"); + + // close event loop so that blocked destructor and stopFind() can be released. + mStopEventLoop.exit(); + + emit findFinished(); } /*! @@ -67,6 +155,9 @@ return 0; } +/*! + Get model column count +*/ int FmFindResultModel::columnCount( const QModelIndex &parent ) const { if ( !parent.isValid() ) @@ -75,6 +166,9 @@ return 0; } +/*! + Get model data +*/ QVariant FmFindResultModel::data( const QModelIndex &index, int role ) const { if (!indexValid( index )) @@ -105,11 +199,17 @@ return QVariant(); } +/*! + Get filePath by \a index +*/ QString FmFindResultModel::filePath ( const QModelIndex & index ) const { return fileInfo( index ).filePath(); } +/*! + Get header data by column number \a section +*/ QVariant FmFindResultModel::headerData( int section, Qt::Orientation orientation, int role ) const { if (orientation == Qt::Horizontal) { @@ -184,6 +284,9 @@ return true; } +/*! + Get QFileInfo by \a index +*/ QFileInfo FmFindResultModel::fileInfo( const QModelIndex &index ) const { if (index.row() >= 0 && index.row() < mFindResult.size()) @@ -192,49 +295,6 @@ return QFileInfo(); } -QString FmFindResultModel::findPath() const -{ - return mFindThread->findPath(); -} - -void FmFindResultModel::setFindPath( const QString &path ) -{ - mFindThread->setFindPath( path ); -} - -QRegExp FmFindResultModel::pattern() const -{ - return mFindThread->pattern(); -} - -void FmFindResultModel::setPattern( const QRegExp ®Exp ) -{ - mFindThread->setPattern( regExp ); -} - -void FmFindResultModel::find() -{ - if(mFindThread->isRunning()) - return; - - if( findPath().isEmpty() ){ - mFindThread->setLastResult( mFindResult ); - } - removeRows( 0, rowCount() ); - mFindThread->start(); -} - -void FmFindResultModel::stop() -{ - mFindThread->stop(); - mFindThread->wait(); -} - -bool FmFindResultModel::isFinding() const -{ - return mFindThread->isRunning(); -} - /* Receive \a dataList as some found result Then insert dataList to model @@ -247,12 +307,23 @@ insertRows( rowCount(), dataList ); } +/* + Get if \a index is valid +*/ bool FmFindResultModel::indexValid( const QModelIndex &index ) const { - Q_UNUSED( index ); - return true; + if( ( index.row() < 0 ) || ( index.row() >= rowCount() ) ) { + return false; + } else if( ( index.column() < 0 ) || ( index.column() >= columnCount() ) ) { + return false; + } else { + return true; + } } +/* + Init model +*/ void FmFindResultModel::init() { mFindThread = new FmFindThread( this ); @@ -260,6 +331,9 @@ mIconProvider = new FmFileIconProvider(); } +/* + Sort by name +*/ bool FmFindResultModel::caseNameLessThan(const QPair &s1, const QPair &s2) { @@ -269,6 +343,9 @@ return info1.fileName() < info2.fileName(); } +/* + Sort by time +*/ bool FmFindResultModel::caseTimeLessThan(const QPair &s1, const QPair &s2) { @@ -278,6 +355,9 @@ return info1.lastModified() < info2.lastModified(); } +/* + Sort by size +*/ bool FmFindResultModel::caseSizeLessThan(const QPair &s1, const QPair &s2) { @@ -287,6 +367,9 @@ return info1.size() < info2.size(); } +/* + Sort by type +*/ bool FmFindResultModel::caseTypeLessThan(const QPair &s1, const QPair &s2) { diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmfindresultmodel.h --- a/filemanager/src/filemanager/src/fmfindresultmodel.h Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfindresultmodel.h Fri Sep 17 08:27:42 2010 +0300 @@ -25,6 +25,8 @@ #include #include #include +#include +#include class FmFindThread; class FmFileIconProvider; @@ -57,14 +59,8 @@ QFileInfo fileInfo( const QModelIndex &index ) const; - QString findPath() const; - void setFindPath( const QString &path ); - - QRegExp pattern() const; - void setPattern( const QRegExp ®Exp ); - - void find(); - void stop(); + void find( const QRegExp ®Exp, const QStringList &pathList ); + void stopFind(); bool isFinding() const; virtual void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder ); @@ -79,19 +75,39 @@ const QPair &s2 ); signals: - void finished(); + + // pass modelCountChanged signal to parent widget + // so parent widget could change contentWiget between emptyTipsWidget and listWidget void modelCountChanged( int count ); + // emit when start find thread. view can set empty menu for itself(sort). + // because sort while search inprogress may cause data synchornous problem in model. + void findStarted(); + + // emit when finished find thread. view can set normal menu for itself(sort). + void findFinished(); + private slots: void on_findThread_found( const QStringList &dataList ); + void startFind(); + void onThreadFinished(); private: bool indexValid( const QModelIndex &index ) const; void init(); + FmFindThread *mFindThread; QStringList mFindResult; FmFileIconProvider *mIconProvider; + + QStringList mFindPath; + QRegExp mRegExp; + bool mIsFindRequestPending; + QTimer mTimer; + + QEventLoop mStopEventLoop; + }; #endif diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmfindthread.cpp --- a/filemanager/src/filemanager/src/fmfindthread.cpp Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfindthread.cpp Fri Sep 17 08:27:42 2010 +0300 @@ -17,6 +17,7 @@ */ #include "fmfindthread.h" +#include "fmcommon.h" #include @@ -38,64 +39,81 @@ Please connect this signal by Qt::BlockingQueuedConnection as dataList will be cleared immediately */ +/*! + Constructor, set thread LowPriority +*/ FmFindThread::FmFindThread( QObject *parent ) : QThread( parent ) { setPriority( LowPriority ); } +/*! + Destructor +*/ FmFindThread::~FmFindThread() { -} - -QString FmFindThread::findPath() const -{ - return mFindPath; + FM_LOG("FmFindThread::~FmFindThread()"); } -void FmFindThread::setFindPath( const QString &path ) +/*! + Set find path list \a pathList +*/ +void FmFindThread::setFindPathList( const QStringList &pathList ) { - mFindPath = path; + mFindPathList.clear(); + mFindPathList = pathList; } -QRegExp FmFindThread::pattern() const -{ - return findPattern; -} - +/*! + Set find pattern +*/ void FmFindThread::setPattern( const QRegExp ®Exp ) { findPattern = regExp; } +/*! + Stop find +*/ void FmFindThread::stop() { + FM_LOG("FmFindThread::stop()"); mStop = true; } +/* + Thread function +*/ void FmFindThread::run() { + FM_LOG( "FmFindThread::run() started "); mStop = false; - tempResultList.clear(); - if (findPattern.isEmpty() || !findPattern.isValid()) - return; - - QDir dir( mFindPath ); - if (!dir.exists()) - return; - - if( mFindPath.isEmpty() ){ - findInResult(); + if (findPattern.isEmpty() || !findPattern.isValid()) { + FM_LOG( "FmFindThread::run() canceled because error param "); return; } - + QList findDirs; - findDirs.append( dir ); + foreach( const QString &path, mFindPathList ) { + QDir dir( path ); + findDirs.append( dir ); + } + + count = 0; time.restart(); mStop = false; while (!findDirs.isEmpty()) { + if (mStop) { + FM_LOG("FmFindThread::run() stopped"); + return; + } QFileInfoList infoList = findDirs.first().entryInfoList(); for (QFileInfoList::Iterator it = infoList.begin(); it != infoList.end(); ++it) { + if (mStop) { + FM_LOG("FmFindThread::run() stopped"); + return; + } QString name = it->fileName(); QString absolutPath = it->absoluteFilePath(); if (findPattern.exactMatch( it->fileName() )) { @@ -107,14 +125,6 @@ } } - //We are stopped; - if (mStop) { - if( tempResultList.count() > 0 ) { - emitFound(); - } - return; - } - // exclude directory named ".." and "." if (it->isDir() && it->fileName() != ParentDir && it->fileName() != CurrentDir ) { findDirs.append( QDir( it->absoluteFilePath() ) ); @@ -132,42 +142,13 @@ */ void FmFindThread::emitFound() { + if (mStop) { + FM_LOG("FmFindThread::emitFound() return because stopped"); + return; + } if( tempResultList.count() > 0 ) { emit found( tempResultList ); tempResultList.clear(); time.restart(); } } - -void FmFindThread::setLastResult( QStringList r ) -{ - mLastResult = r; -} - -/* - Find keyword in last result - \sa setLastResult, this function must be called to set last result for findInResult -*/ -void FmFindThread::findInResult() -{ - if( mFindPath.isEmpty() ){ - for (QStringList::Iterator it = mLastResult.begin(); it != mLastResult.end(); ++it) { - if (mStop){ - return; - } - QString absolutPath = (*it); - QFileInfo fileInfo( absolutPath ); - QString fileName = fileInfo.fileName(); - - if (findPattern.exactMatch( fileName ) ) { - tempResultList.append( absolutPath ); - if ( tempResultList.count() > notifyPerCount ) { - emitFound(); - } else if (time.elapsed() > notifyPerElapsedTime && tempResultList.count() > 0) { - emitFound(); - } - } - } - } - emitFound(); -} diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmfindthread.h --- a/filemanager/src/filemanager/src/fmfindthread.h Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfindthread.h Fri Sep 17 08:27:42 2010 +0300 @@ -33,14 +33,9 @@ explicit FmFindThread( QObject *parent = 0 ); ~FmFindThread(); - QString findPath() const; - void setFindPath( const QString &path ); - - QRegExp pattern() const; + void setFindPathList( const QStringList &pathList ); void setPattern( const QRegExp ®Exp ); - - void setLastResult( QStringList r ); - + void stop(); signals: @@ -51,14 +46,13 @@ private: void emitFound(); - void findInResult(); volatile bool mStop; int count; - QString mFindPath; + QStringList mFindPathList; QTime time; QRegExp findPattern; - QStringList mLastResult; + // Used to store temp search result. if emit found, the result will be cleared. QStringList tempResultList; }; diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmfindview.cpp --- a/filemanager/src/filemanager/src/fmfindview.cpp Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfindview.cpp Fri Sep 17 08:27:42 2010 +0300 @@ -26,20 +26,17 @@ #include FmFindView::FmFindView() : FmViewBase( EFindView ), - mWaitNote( 0 ), mMenu( 0 ) { initMenu(); initMainWidget(); initToolBar(); - + setTitle( hbTrId("find") ); QMetaObject::connectSlotsByName( this ); } FmFindView::~FmFindView() { - delete mWaitNote; - mWaitNote = 0; } void FmFindView::activated( const QString& pathName ) @@ -48,33 +45,13 @@ FmViewManager::viewManager()->createFileView( pathName, true, true ); } -void FmFindView::find( const QString &keyword, const QString &path ) -{ - setTitle( keyword ); - mFindWidget->find( keyword, path ); - mWaitNote->open(); -} - -void FmFindView::stopFind() +void FmFindView::find( const QString &keyword, const QStringList &pathList ) { - mFindWidget->stopFind(); -} - -void FmFindView::findFinished() -{ - if( mWaitNote ){ - mWaitNote->close(); - } -// mFindWidget->activeSearchPanel(); + mFindWidget->find( keyword, pathList ); } void FmFindView::initMenu() { - HbAction *findAction = new HbAction( this ); - findAction->setObjectName( "findAction" ); - findAction->setText( hbTrId( "Find" ) ); - menu()->addAction( findAction ); - HbMenu *subMenu = new HbMenu( hbTrId( "Sort" ) ); HbAction *sortNameAction = new HbAction( subMenu ); @@ -99,8 +76,6 @@ menu()->addMenu( subMenu ); - connect( findAction, SIGNAL( triggered() ), - this, SLOT( on_findAction_triggered() ) ); connect( sortNameAction, SIGNAL( triggered() ), this, SLOT( on_sortNameAction_triggered() ) ); connect( sortTimeAction, SIGNAL( triggered() ), @@ -116,17 +91,9 @@ void FmFindView::initMainWidget() { mFindWidget = new FmFindWidget( this ); - connect( mFindWidget, SIGNAL(finished()), this, SLOT(findFinished()) ); setWidget( mFindWidget ); - if( !mWaitNote ){ - mWaitNote = new HbProgressDialog( HbProgressDialog::WaitDialog ); - mWaitNote->setText( hbTrId( "Finding..." ) ); - } - connect( mWaitNote, SIGNAL(cancelled()), this, SLOT(stopFind()) ); connect( mFindWidget, SIGNAL(activated( const QString&)), this, SLOT( activated(const QString&)) ); - connect( mFindWidget, SIGNAL( startSearch( const QString&, const QString& ) ), - this, SLOT( startSearch( const QString&, const QString& ) ) ); connect( mFindWidget, SIGNAL( setEmptyMenu( bool ) ), this, SLOT( on_findWidget_setEmptyMenu( bool ) ) ); } @@ -155,18 +122,6 @@ mFindWidget->sortFiles( FmFindResultModel::Type ); } -void FmFindView::startSearch( const QString &targetPath, const QString &criteria ) -{ - if ( !criteria.isEmpty( ) ) { - find( criteria, targetPath ); - } -} - -void FmFindView::on_findAction_triggered() -{ - mFindWidget->activeSearchPanel(); -} - void FmFindView::on_findWidget_setEmptyMenu( bool isMenuEmpty ) { if( isMenuEmpty ){ @@ -181,3 +136,8 @@ } } } + +void FmFindView::aboutToClose() +{ + mFindWidget->stopFind(); +} diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmfindview.h --- a/filemanager/src/filemanager/src/fmfindview.h Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfindview.h Fri Sep 17 08:27:42 2010 +0300 @@ -34,22 +34,17 @@ FmFindView(); virtual ~FmFindView(); - void find( const QString &keyword, const QString &path ); + void find( const QString &keyword, const QStringList &pathList ); public slots: void activated( const QString &pathName ); - void stopFind(); - + private slots: - void findFinished(); - void on_findAction_triggered(); void on_sortNameAction_triggered(); void on_sortTimeAction_triggered(); void on_sortSizeAction_triggered(); void on_sortTypeAction_triggered(); - void startSearch( const QString &targetPath, const QString &criteria ); - void on_findWidget_setEmptyMenu( bool isMenuEmpty ); private: @@ -57,8 +52,10 @@ void initMainWidget(); void initToolBar(); + // from FmViewBase + virtual void aboutToClose(); + FmFindWidget *mFindWidget; - HbProgressDialog *mWaitNote; HbMenu *mMenu; }; diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmfindwidget.cpp --- a/filemanager/src/filemanager/src/fmfindwidget.cpp Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfindwidget.cpp Fri Sep 17 08:27:42 2010 +0300 @@ -29,15 +29,20 @@ #include #include #include +#include FmFindWidget::FmFindWidget( QGraphicsItem *parent ) : HbWidget( parent ) { + FM_LOG("FmFindWidget::FmFindWidget()"); init(); } FmFindWidget::~FmFindWidget() { + FM_LOG("FmFindWidget::~FmFindWidget() START"); + delete mModel; + FM_LOG("FmFindWidget::~FmFindWidget() END"); } void FmFindWidget::itemActivated(const QModelIndex &index) @@ -55,88 +60,59 @@ } } -void FmFindWidget::find( const QString &keyword, const QString &path ) +void FmFindWidget::find( const QString &keyword, const QStringList &pathList ) { - mModel->setFindPath( path ); - - QRegExp regExp( '*' + keyword + '*' ); - regExp.setPatternSyntax( QRegExp::Wildcard ); - regExp.setCaseSensitivity( Qt::CaseInsensitive ); - mModel->setPattern( regExp ); - - mModel->find(); + mPathList = pathList; + // find will auto-start after receive criteria change event. + mSearchPanel->setCriteria( keyword ); } void FmFindWidget::stopFind() { - mModel->stop(); -} - -void FmFindWidget::on_resultModel_finished() -{ - emit finished(); + mModel->stopFind(); } void FmFindWidget::on_resultModel_modelCountChanged( int count ) { if( count > 0 ) { - activateContentWidget( ResultListView ); + mContentWidget->setCurrentWidget( mListView ); } else { - activateContentWidget( EmptyTipWidget ); + mContentWidget->setCurrentWidget( mEmptyTipWidget ); } } -void FmFindWidget::activateContentWidget( ContentWidgetType contentWidgetType ) +void FmFindWidget::on_resultModel_findStarted() { - switch( contentWidgetType ) - { - case EmptyTipWidget: - { - if( mLayout->count() > 0 ) { - if( mLayout->itemAt( 0 ) == mListView ) { - mLayout->removeItem( mListView ); - mLayout->addItem( mEmptyTipWidget ); - } - } else { - mLayout->addItem( mEmptyTipWidget ); - } - mListView->hide(); - mEmptyTipWidget->show(); - deActiveSearchPanel(); - emit setEmptyMenu( true ); - } - break; - case ResultListView: - { - if( mLayout->count() > 0 ) { - if( mLayout->itemAt( 0 ) == mEmptyTipWidget ) { - mLayout->removeItem( mEmptyTipWidget ); - mLayout->addItem( mListView ); - } - } else { - mLayout->addItem( mListView ); - } - mEmptyTipWidget->hide(); - mListView->show(); - activeSearchPanel(); - emit setEmptyMenu( false ); - } - break; - } + emit setEmptyMenu( true ); +} + +void FmFindWidget::on_resultModel_findFinished() +{ + emit setEmptyMenu( false ); } void FmFindWidget::init() { mLayout = new QGraphicsLinearLayout( this ); mLayout->setOrientation( Qt::Vertical ); + + mContentWidget = new HbStackedWidget( this ); + mLayout->addItem( mContentWidget ); + initSearchPanel(); + mLayout->addItem( mSearchPanel ); + setLayout( mLayout ); mModel = new FmFindResultModel( this ); mModel->setObjectName( "resultModel" ); - connect( mModel, SIGNAL(finished()), this, SLOT( on_resultModel_finished()) ); + connect( mModel, SIGNAL( modelCountChanged( int )), + this, SLOT( on_resultModel_modelCountChanged( int )), Qt::QueuedConnection ); - connect( mModel, SIGNAL( modelCountChanged( int )), - this, SLOT( on_resultModel_modelCountChanged( int )) ); + connect( mModel, SIGNAL( findStarteded()), + this, SLOT( on_resultModel_findStarted()) ); + + connect( mModel, SIGNAL( findFinished()), + this, SLOT( on_resultModel_findFinished()) ); mListView = new HbListView( this ); mListView->setModel( mModel ); @@ -146,11 +122,10 @@ HbLabel *emptyTipLable = new HbLabel( hbTrId( "No found files or folders" ), mEmptyTipWidget ); emptyTipLayout->addItem( emptyTipLable ); - initSearchPanel(); - activateContentWidget( EmptyTipWidget ); + mContentWidget->addWidget( mListView ); + mContentWidget->addWidget( mEmptyTipWidget ); - setLayout( mLayout ); - + mContentWidget->setCurrentWidget( mEmptyTipWidget ); connect( mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex))); } @@ -158,15 +133,14 @@ { mSearchPanel = new HbSearchPanel( this ); mSearchPanel->setObjectName( "searchPanel" ); -// mSearchPanel->setSearchOptionsEnabled( true ); - mSearchPanel->setProgressive( false ); - mSearchPanel->hide(); + mSearchPanel->setSearchOptionsEnabled( false ); + mSearchPanel->setProgressive( true ); connect( mSearchPanel, SIGNAL( criteriaChanged( const QString & ) ), - this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ) ); + this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ), Qt::QueuedConnection ); connect( mSearchPanel, SIGNAL( exitClicked() ), - this, SLOT( on_searchPanel_exitClicked() ) ); + this, SLOT( on_searchPanel_exitClicked() ), Qt::QueuedConnection ); } void FmFindWidget::sortFiles( FmFindResultModel::SortFlag sortFlag ) @@ -174,29 +148,23 @@ mModel->sort( sortFlag ); } -void FmFindWidget::activeSearchPanel() -{ - mLayout->addItem( mSearchPanel ); - mSearchPanel->show(); -} - void FmFindWidget::on_searchPanel_criteriaChanged( const QString &criteria ) { - mFindTargetPath.clear(); - emit startSearch( mFindTargetPath, criteria ); + QRegExp regExp; + if( !criteria.isEmpty() ) { + regExp.setPattern( '*' + criteria + '*' ); + } + // if criteria is empty, then keep regExp empty. find thread will return empty result. + + regExp.setPatternSyntax( QRegExp::Wildcard ); + regExp.setCaseSensitivity( Qt::CaseInsensitive ); + + mModel->find( regExp, mPathList ); } void FmFindWidget::on_searchPanel_exitClicked() { - mSearchPanel->hide(); - mLayout->removeItem( mSearchPanel ); -} - -void FmFindWidget::deActiveSearchPanel() -{ - mSearchPanel->hide(); - mLayout->removeItem( mSearchPanel ); - + FmViewManager::viewManager()->popViewAndShow(); } diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmfindwidget.h --- a/filemanager/src/filemanager/src/fmfindwidget.h Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfindwidget.h Fri Sep 17 08:27:42 2010 +0300 @@ -28,6 +28,7 @@ class HbListView; class HbSearchPanel; class HbWidget; +class HbStackedWidget; class QGraphicsLinearLayout; @@ -35,26 +36,15 @@ { Q_OBJECT public: - enum ContentWidgetType - { - EmptyTipWidget, - ResultListView - }; FmFindWidget( QGraphicsItem *parent = 0 ); ~FmFindWidget(); - void find( const QString &keyword, const QString &path ); + void find( const QString &keyword, const QStringList &pathList ); void stopFind(); void sortFiles( FmFindResultModel::SortFlag sortFlag ); - - void activeSearchPanel(); - void deActiveSearchPanel(); signals: - void finished(); void activated( const QString &pathName ); - - void startSearch( const QString &targetPath, const QString &criteria ); void setEmptyMenu( bool isMenuEmpty ); private slots: @@ -63,13 +53,14 @@ void on_searchPanel_criteriaChanged( const QString &criteria ); void on_searchPanel_exitClicked(); - void on_resultModel_finished(); void on_resultModel_modelCountChanged( int count ); + + void on_resultModel_findStarted(); + void on_resultModel_findFinished(); private: void init(); void initSearchPanel(); - void activateContentWidget( ContentWidgetType contentWidgetType ); private: HbListView *mListView; @@ -77,8 +68,16 @@ HbWidget *mEmptyTipWidget; QGraphicsLinearLayout *mLayout; - HbSearchPanel* mSearchPanel; - QString mFindTargetPath; + + // used to stack emptytip widget and list view. + // only one widget can be shown at the same time. + HbStackedWidget *mContentWidget; + + HbSearchPanel* mSearchPanel; + + // store the find path list + // for example, if start find from drive view. All available drive will be used to find + QStringList mPathList; }; #endif diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmviewbase.cpp --- a/filemanager/src/filemanager/src/fmviewbase.cpp Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmviewbase.cpp Fri Sep 17 08:27:42 2010 +0300 @@ -44,3 +44,10 @@ FmViewManager::viewManager()->popViewAndShow(); } +/*! + called when about to close. used to close some resource before deleted. + */ +void FmViewBase::aboutToClose() +{ + +} \ No newline at end of file diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmviewbase.h --- a/filemanager/src/filemanager/src/fmviewbase.h Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmviewbase.h Fri Sep 17 08:27:42 2010 +0300 @@ -47,7 +47,7 @@ { return mViewType; } - + virtual void aboutToClose(); private slots: void on_backAction_triggered(); @@ -56,6 +56,7 @@ private: void init(); + private: TViewType mViewType; diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmviewmanager.cpp --- a/filemanager/src/filemanager/src/fmviewmanager.cpp Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmviewmanager.cpp Fri Sep 17 08:27:42 2010 +0300 @@ -39,6 +39,8 @@ #include #include +#include + FmViewManager *FmViewManager::mViewManager = 0; @@ -73,7 +75,7 @@ return mDialog; } -FmViewManager::FmViewManager( FmMainWindow* mainWindow ) : mOperationService( 0 ) +FmViewManager::FmViewManager( FmMainWindow* mainWindow ) : mOperationService( 0 ), mShareUi( 0 ) { mMainWindow = mainWindow; mDriveWatcher = new FmDriveWatcher( this ); @@ -98,6 +100,9 @@ mDriveWatcher->cancelWatch(); delete mDriveWatcher; mDriveWatcher = 0; + + delete mShareUi; + mShareUi = 0; } @@ -129,6 +134,17 @@ return mOperationService; } +/* + return \a shareUi which is used to send files. + */ +ShareUi *FmViewManager::shareUi() +{ + if( !mShareUi ) { + mShareUi = new ShareUi; + } + return mShareUi; +} + void FmViewManager::popViewAndShow() { FmViewBase *view = static_cast( mMainWindow->currentView() ); @@ -137,7 +153,13 @@ if( viewCount() == 1 ) { mScreenShot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect()); } - mMainWindow->removeView( view ); + mMainWindow->removeView( view ); + // If call QEventLoop in destructor of HbView, it will panic + // So add aboutToClose function to do some prepare when view will be closed + // for example, close find view while find is inprogress. + // stop find thread in destructor of FmFindView(called by delete container->model...) + // and use QEventLoop to wait till thread exit. + view->aboutToClose(); delete view; if( viewCount() < 1 ) @@ -236,14 +258,17 @@ this, SLOT( popViewAndShow() ), Qt::QueuedConnection ); } -void FmViewManager::createFindView( const QString &keyword, const QString &path ) +/* + Create fild view and search \a keyword in \a pathList +*/ +void FmViewManager::createFindView( const QString &keyword, const QStringList &pathList ) { FmFindView *findView= new FmFindView(); mMainWindow->addView( findView ); mMainWindow->setCurrentView( findView ); - findView->find( keyword, path ); + findView->find( keyword, pathList ); } void FmViewManager::createSplitView() @@ -327,10 +352,7 @@ HbActivityManager* activityManager = qobject_cast(qApp)->activityManager(); // add the activity to the activity manager bool ok = activityManager->addActivity("FMMemoryStoragesList", QVariant(), metadata); - if ( !ok ) - { - qFatal("Add failed" ); - } + // do not need check return value } diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/filemanager/src/fmviewmanager.h --- a/filemanager/src/filemanager/src/fmviewmanager.h Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/filemanager/src/fmviewmanager.h Fri Sep 17 08:27:42 2010 +0300 @@ -32,6 +32,7 @@ class QFileSystemWatcher; class FmDriveWatcher; class FmDialog; +class ShareUi; /* * this class is used to record relationship between dialog and drive name @@ -65,12 +66,13 @@ static void RemoveViewManager(); static FmViewManager *viewManager(); FmOperationService *operationService(); + ShareUi *shareUi(); Qt::Orientation orientation(); void createFileView( const QString &path, - bool enableBackPathCheck = true, bool disableFind = false ); - void createFindView( const QString &keyword, const QString &path ); + bool enableBackPathCheck = true, bool disableFind = false ); + void createFindView( const QString &keyword, const QStringList &pathList ); void createDriverView(); void createSplitView(); void createBackupView(); @@ -146,6 +148,9 @@ QList mDlgCloseUnitList; QPixmap mScreenShot; + + // used to send files + ShareUi *mShareUi; }; diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/inc/fmdefine.h --- a/filemanager/src/inc/fmdefine.h Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/inc/fmdefine.h Fri Sep 17 08:27:42 2010 +0300 @@ -67,6 +67,8 @@ // define contact data path for view details. #define FmViewDetail_Contacts ( "\\private\\10003a73\\SQLite__Contacts.cdb" ) +// define message data path for view details +#define FmViewDetail_Messages ( "\\private\\1000484b\\Mail2" ) #define FmMaxLengthofDriveName 11 #define FmMaxLengthofDrivePassword 8 diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/inc/fmutils.h --- a/filemanager/src/inc/fmutils.h Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/inc/fmutils.h Fri Sep 17 08:27:42 2010 +0300 @@ -197,7 +197,6 @@ // other fucntions static int launchFile( const QString &filePath ); - static void sendFiles( QStringList &filePathList ); static QString getBurConfigPath( QString appPath ); static QString getFileType( const QString &filePath ); static bool isDriveC( const QString &driverName ); diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/inc/fmutils_s60.cpp --- a/filemanager/src/inc/fmutils_s60.cpp Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/inc/fmutils_s60.cpp Fri Sep 17 08:27:42 2010 +0300 @@ -40,7 +40,6 @@ #include #include -#include #include #include @@ -775,15 +774,6 @@ } /*! - Send files( \a filePathList ) with share ui. -*/ -void FmUtils::sendFiles( QStringList &filePathList ) -{ - ShareUi shareui; - shareui.send( filePathList, false ); -} - -/*! return path for backup restore config file. Currently \a appPath is not used. */ diff -r fc4654ce4fcb -r 22e202702210 filemanager/src/inc/fmutils_win.cpp --- a/filemanager/src/inc/fmutils_win.cpp Thu Sep 02 20:16:57 2010 +0300 +++ b/filemanager/src/inc/fmutils_win.cpp Fri Sep 17 08:27:42 2010 +0300 @@ -208,11 +208,6 @@ } } -void FmUtils::sendFiles( QStringList &filePathList ) -{ - Q_UNUSED( filePathList ); -} - QString FmUtils::getBurConfigPath( QString appPath ) { QFileInfo fileInfo( appPath ); diff -r fc4654ce4fcb -r 22e202702210 package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Fri Sep 17 08:27:42 2010 +0300 @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r fc4654ce4fcb -r 22e202702210 package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Fri Sep 17 08:27:42 2010 +0300 @@ -0,0 +1,1 @@ +