2001-10-18 09:14:25 +00:00
|
|
|
#ifndef KQUERY_H
|
|
|
|
#define KQUERY_H
|
|
|
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#include <qobject.h>
|
|
|
|
#include <qregexp.h>
|
2005-09-02 08:05:27 +00:00
|
|
|
#include <QQueue>
|
2003-04-28 17:44:25 +00:00
|
|
|
#include <qdir.h>
|
2005-02-05 22:28:10 +00:00
|
|
|
#include <qstringlist.h>
|
2001-10-18 09:14:25 +00:00
|
|
|
|
|
|
|
#include <kio/job.h>
|
|
|
|
#include <kurl.h>
|
2003-04-20 19:38:31 +00:00
|
|
|
#include <kprocess.h>
|
2001-10-18 09:14:25 +00:00
|
|
|
|
|
|
|
class KFileItem;
|
|
|
|
|
|
|
|
class KQuery : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
KQuery(QObject *parent = 0, const char * name = 0);
|
|
|
|
~KQuery();
|
|
|
|
|
|
|
|
void setSizeRange( int min, int max );
|
|
|
|
void setTimeRange( time_t from, time_t to );
|
2001-10-18 21:30:11 +00:00
|
|
|
void setRegExp( const QString ®exp, bool caseSensitive );
|
2001-10-18 09:14:25 +00:00
|
|
|
void setRecursive( bool recursive );
|
|
|
|
void setPath(const KURL & url );
|
|
|
|
void setFileType( int filetype );
|
2003-10-29 18:33:34 +00:00
|
|
|
void setMimeType( const QStringList & mimetype );
|
2003-05-26 18:16:17 +00:00
|
|
|
void setContext( const QString & context, bool casesensitive,
|
2005-07-28 14:59:42 +00:00
|
|
|
bool search_binary, bool useRegexp );
|
2002-04-11 22:41:29 +00:00
|
|
|
void setUsername( QString username );
|
|
|
|
void setGroupname( QString groupname );
|
2005-07-28 14:59:42 +00:00
|
|
|
void setMetaInfo(const QString &metainfo, const QString &metainfokey);
|
2003-04-20 19:38:31 +00:00
|
|
|
void setUseFileIndex(bool);
|
2001-10-18 09:14:25 +00:00
|
|
|
|
|
|
|
void start();
|
|
|
|
void kill();
|
2002-04-10 22:25:55 +00:00
|
|
|
const KURL& url() {return m_url;};
|
|
|
|
|
2003-04-20 19:38:31 +00:00
|
|
|
private:
|
|
|
|
/* Check if file meets the find's requirements*/
|
|
|
|
inline void processQuery(KFileItem*);
|
|
|
|
|
2003-07-24 17:20:12 +00:00
|
|
|
public slots:
|
|
|
|
/* List of files found using slocate */
|
|
|
|
void slotListEntries(QStringList);
|
2001-10-18 09:14:25 +00:00
|
|
|
protected slots:
|
2003-04-20 19:38:31 +00:00
|
|
|
/* List of files found using KIO */
|
2001-10-18 09:14:25 +00:00
|
|
|
void slotListEntries(KIO::Job *, const KIO::UDSEntryList &);
|
|
|
|
void slotResult(KIO::Job *);
|
|
|
|
void slotCanceled(KIO::Job *);
|
2003-04-20 19:38:31 +00:00
|
|
|
void slotreceivedSdtout(KProcess*,char*,int);
|
|
|
|
void slotreceivedSdterr(KProcess*,char*,int);
|
|
|
|
void slotendProcessLocate(KProcess*);
|
2001-10-18 09:14:25 +00:00
|
|
|
|
|
|
|
signals:
|
2001-11-04 11:38:26 +00:00
|
|
|
void addFile(const KFileItem *filename, const QString& matchingLine);
|
2001-10-18 09:14:25 +00:00
|
|
|
void result(int);
|
|
|
|
|
|
|
|
private:
|
2003-06-28 10:44:54 +00:00
|
|
|
void checkEntries();
|
|
|
|
|
2001-10-18 09:14:25 +00:00
|
|
|
int m_filetype;
|
|
|
|
int m_minsize;
|
|
|
|
int m_maxsize;
|
|
|
|
KURL m_url;
|
|
|
|
time_t m_timeFrom;
|
|
|
|
time_t m_timeTo;
|
2002-02-10 00:23:04 +00:00
|
|
|
QRegExp m_regexp;// regexp for file content
|
2001-10-18 09:14:25 +00:00
|
|
|
bool m_recursive;
|
2003-10-29 18:33:34 +00:00
|
|
|
QStringList m_mimetype;
|
2001-10-18 09:14:25 +00:00
|
|
|
QString m_context;
|
2002-04-11 22:41:29 +00:00
|
|
|
QString m_username;
|
|
|
|
QString m_groupname;
|
2002-06-22 10:16:44 +00:00
|
|
|
QString m_metainfo;
|
|
|
|
QString m_metainfokey;
|
2001-10-18 09:14:25 +00:00
|
|
|
bool m_casesensitive;
|
2003-05-26 18:16:17 +00:00
|
|
|
bool m_search_binary;
|
2001-10-18 09:14:25 +00:00
|
|
|
bool m_regexpForContent;
|
2003-04-20 19:38:31 +00:00
|
|
|
bool m_useLocate;
|
|
|
|
char* bufferLocate;
|
|
|
|
int bufferLocateLength;
|
|
|
|
QStringList locateList;
|
|
|
|
KProcess *processLocate;
|
2005-07-28 14:59:42 +00:00
|
|
|
Q3PtrList<QRegExp> m_regexps;// regexps for file name
|
2005-02-05 22:45:02 +00:00
|
|
|
// QValueList<bool> m_regexpsContainsGlobs; // what should this be good for ? Alex
|
2001-10-18 09:14:25 +00:00
|
|
|
KIO::ListJob *job;
|
2003-06-28 10:44:54 +00:00
|
|
|
bool m_insideCheckEntries;
|
2005-09-02 08:05:27 +00:00
|
|
|
QQueue<KFileItem *> m_fileItems;
|
2003-04-20 19:38:31 +00:00
|
|
|
QRegExp* metaKeyRx;
|
2003-06-28 15:24:47 +00:00
|
|
|
int m_result;
|
2005-02-05 22:28:10 +00:00
|
|
|
QStringList ignore_mimetypes;
|
|
|
|
QStringList ooo_mimetypes; // OpenOffice.org mimetypes
|
|
|
|
QStringList koffice_mimetypes;
|
2001-10-18 09:14:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|