summaryrefslogtreecommitdiffstats
path: root/kfind/kquery.h
blob: a599cdbf1af4515b7df7c6b3884bbfa6fc98274b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#ifndef KQUERY_H
#define KQUERY_H

#include <time.h>

#include <tqobject.h>
#include <tqregexp.h>
#include <tqptrqueue.h>
#include <tqdir.h>
#include <tqstringlist.h>

#include <kio/job.h>
#include <kurl.h>
#include <kprocess.h>

class KFileItem;

class KQuery : public QObject
{
  Q_OBJECT

 public:
  KQuery(TQObject *parent = 0, const char * name = 0);
  ~KQuery();

  void setSizeRange( int mode, KIO::filesize_t value1, KIO::filesize_t value2 );
  void setTimeRange( time_t from, time_t to );
  void setRegExp( const TQString &regexp, bool caseSensitive );
  void setRecursive( bool recursive );
  void setPath(const KURL & url );
  void setFileType( int filetype );
  void setMimeType( const TQStringList & mimetype );
  void setContext( const TQString & context, bool casesensitive, 
    bool search_binary, bool useRegexp );
  void setUsername( TQString username );
  void setGroupname( TQString groupname );
	void setMetaInfo(const TQString &metainfo, const TQString &metainfokey);
  void setUseFileIndex(bool);

  void start();
  void kill();
  const KURL& url()              {return m_url;};

 private:
  /* Check if file meets the find's requirements*/
  inline void processQuery(KFileItem*);

 public slots: 
  /* List of files found using slocate */
  void slotListEntries(TQStringList);
 protected slots:
  /* List of files found using KIO */
  void slotListEntries(KIO::Job *, const KIO::UDSEntryList &);
  void slotResult(KIO::Job *);
  void slotCanceled(KIO::Job *);
  void slotreceivedSdtout(KProcess*,char*,int);
  void slotreceivedSdterr(KProcess*,char*,int);
  void slotendProcessLocate(KProcess*);

 signals:
  void addFile(const KFileItem *filename, const TQString& matchingLine);
  void result(int);

 private:
  void checkEntries();

  int m_filetype;
  int m_sizemode;
  KIO::filesize_t m_sizeboundary1;
  KIO::filesize_t m_sizeboundary2;
  KURL m_url;
  time_t m_timeFrom;
  time_t m_timeTo;
  TQRegExp m_regexp;// regexp for file content
  bool m_recursive;
  TQStringList m_mimetype;
  TQString m_context;
  TQString m_username;
  TQString m_groupname;
  TQString m_metainfo;
  TQString m_metainfokey;
  bool m_casesensitive;
  bool m_search_binary;
  bool m_regexpForContent;
  bool m_useLocate;
  char* bufferLocate;
  int bufferLocateLength;
  TQStringList locateList;
  KProcess *processLocate;
  TQPtrList<TQRegExp> m_regexps;// regexps for file name
//  TQValueList<bool> m_regexpsContainsGlobs;  // what should this be good for ? Alex
  KIO::ListJob *job;
  bool m_insideCheckEntries;
  TQPtrQueue<KFileItem> m_fileItems;
  TQRegExp* metaKeyRx;
  int m_result;
  TQStringList ignore_mimetypes;
  TQStringList ooo_mimetypes;     // OpenOffice.org mimetypes
  TQStringList koffice_mimetypes;
};

#endif