Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / kfind / kquery.h
blobb7cde7645745e30b83b0cb6bab4816e5bb0b0040
1 #ifndef KQUERY_H
2 #define KQUERY_H
4 #include <time.h>
6 #include <QtCore/QObject>
7 #include <QtCore/QRegExp>
8 #include <QtCore/QQueue>
9 #include <QtCore/QList>
10 #include <QtCore/QDir>
11 #include <QtCore/QStringList>
13 #include <kio/job.h>
14 #include <kurl.h>
15 #include <kprocess.h>
17 class KFileItem;
19 class KQuery : public QObject
21 Q_OBJECT
23 public:
24 KQuery(QObject *parent = 0);
25 ~KQuery();
27 void setSizeRange( int mode, KIO::filesize_t value1, KIO::filesize_t value2);
28 void setTimeRange( time_t from, time_t to );
29 void setRegExp( const QString &regexp, bool caseSensitive );
30 void setRecursive( bool recursive );
31 void setPath(const KUrl & url );
32 void setFileType( int filetype );
33 void setMimeType( const QStringList & mimetype );
34 void setContext( const QString & context, bool casesensitive,
35 bool search_binary, bool useRegexp );
36 void setUsername( const QString &username );
37 void setGroupname( const QString &groupname );
38 void setMetaInfo(const QString &metainfo, const QString &metainfokey);
39 void setUseFileIndex(bool);
41 void start();
42 void kill();
43 const KUrl& url() {return m_url;}
45 private:
46 /* Check if file meets the find's requirements*/
47 inline void processQuery(const KFileItem &);
49 public Q_SLOTS:
50 /* List of files found using slocate */
51 void slotListEntries(QStringList);
52 protected Q_SLOTS:
53 /* List of files found using KIO */
54 void slotListEntries(KIO::Job *, const KIO::UDSEntryList &);
55 void slotResult(KJob *);
56 void slotCanceled(KJob *);
57 void slotreadyReadStandardOutput();
58 void slotreadyReadStandardError();
59 void slotendProcessLocate(int, QProcess::ExitStatus);
61 Q_SIGNALS:
62 void addFile(const KFileItem &filename, const QString& matchingLine);
63 void result(int);
65 private:
66 void checkEntries();
68 int m_filetype;
69 int m_sizemode;
70 KIO::filesize_t m_sizeboundary1;
71 KIO::filesize_t m_sizeboundary2;
72 KUrl m_url;
73 time_t m_timeFrom;
74 time_t m_timeTo;
75 QRegExp m_regexp;// regexp for file content
76 bool m_recursive;
77 QStringList m_mimetype;
78 QString m_context;
79 QString m_username;
80 QString m_groupname;
81 QString m_metainfo;
82 QString m_metainfokey;
83 bool m_casesensitive;
84 bool m_search_binary;
85 bool m_regexpForContent;
86 bool m_useLocate;
87 QByteArray bufferLocate;
88 QStringList locateList;
89 KProcess *processLocate;
90 QList<QRegExp*> m_regexps;// regexps for file name
91 // QValueList<bool> m_regexpsContainsGlobs; // what should this be good for ? Alex
92 KIO::ListJob *job;
93 bool m_insideCheckEntries;
94 QQueue<KFileItem> m_fileItems;
95 QRegExp* metaKeyRx;
96 int m_result;
97 QStringList ignore_mimetypes;
98 QStringList ooo_mimetypes; // OpenOffice.org mimetypes
99 QStringList koffice_mimetypes;
102 #endif