--- 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 <QFileInfo>
#include <QStringList>
#include <QAbstractListModel>
+#include <QTimer>
+#include <QEventLoop>
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<QString,int> &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