00001 #ifndef KQUERY_H
00002 #define KQUERY_H
00003
00004 #include <time.h>
00005
00006 #include <tqobject.h>
00007 #include <tqregexp.h>
00008 #include <tqptrqueue.h>
00009 #include <tqdir.h>
00010 #include <tqstringlist.h>
00011
00012 #include <kio/job.h>
00013 #include <kurl.h>
00014 #include <kprocess.h>
00015
00016 class KFileItem;
00017
00018 class KQuery : public QObject
00019 {
00020 Q_OBJECT
00021
00022 public:
00023 KQuery(TQObject *parent = 0, const char * name = 0);
00024 ~KQuery();
00025
00026 void setSizeRange( int mode, KIO::filesize_t value1, KIO::filesize_t value2 );
00027 void setTimeRange( time_t from, time_t to );
00028 void setRegExp( const TQString ®exp, bool caseSensitive );
00029 void setRecursive( bool recursive );
00030 void setPath(const KURL & url );
00031 void setFileType( int filetype );
00032 void setMimeType( const TQStringList & mimetype );
00033 void setContext( const TQString & context, bool casesensitive,
00034 bool search_binary, bool useRegexp );
00035 void setUsername( TQString username );
00036 void setGroupname( TQString groupname );
00037 void setMetaInfo(const TQString &metainfo, const TQString &metainfokey);
00038 void setUseFileIndex(bool);
00039
00040 void start();
00041 void kill();
00042 const KURL& url() {return m_url;};
00043
00044 private:
00045
00046 inline void processQuery(KFileItem*);
00047
00048 public slots:
00049
00050 void slotListEntries(TQStringList);
00051 protected slots:
00052
00053 void slotListEntries(KIO::Job *, const KIO::UDSEntryList &);
00054 void slotResult(KIO::Job *);
00055 void slotCanceled(KIO::Job *);
00056 void slotreceivedSdtout(KProcess*,char*,int);
00057 void slotreceivedSdterr(KProcess*,char*,int);
00058 void slotendProcessLocate(KProcess*);
00059
00060 signals:
00061 void addFile(const KFileItem *filename, const TQString& matchingLine);
00062 void result(int);
00063
00064 private:
00065 void checkEntries();
00066
00067 int m_filetype;
00068 int m_sizemode;
00069 KIO::filesize_t m_sizeboundary1;
00070 KIO::filesize_t m_sizeboundary2;
00071 KURL m_url;
00072 time_t m_timeFrom;
00073 time_t m_timeTo;
00074 TQRegExp m_regexp;
00075 bool m_recursive;
00076 TQStringList m_mimetype;
00077 TQString m_context;
00078 TQString m_username;
00079 TQString m_groupname;
00080 TQString m_metainfo;
00081 TQString m_metainfokey;
00082 bool m_casesensitive;
00083 bool m_search_binary;
00084 bool m_regexpForContent;
00085 bool m_useLocate;
00086 char* bufferLocate;
00087 int bufferLocateLength;
00088 TQStringList locateList;
00089 KProcess *processLocate;
00090 TQPtrList<TQRegExp> m_regexps;
00091
00092 KIO::ListJob *job;
00093 bool m_insideCheckEntries;
00094 TQPtrQueue<KFileItem> m_fileItems;
00095 TQRegExp* metaKeyRx;
00096 int m_result;
00097 TQStringList ignore_mimetypes;
00098 TQStringList ooo_mimetypes;
00099 TQStringList koffice_mimetypes;
00100 };
00101
00102 #endif