summaryrefslogtreecommitdiffstats
path: root/khelpcenter/htmlsearch/htmlsearch.h
blob: f5568218cb2a6e6a9178b88898ef96d4bfbbfe26 (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
#ifndef __HTMLSEARCH_H__
#define __HTMLSEARCH_H__


#include <qstring.h>
#include <qstringlist.h>


class QWidget;
class QProgressDialog;


class KProcess;


class ProgressDialog;


class HTMLSearch : public QObject
{
  Q_OBJECT

public:

  HTMLSearch();

  bool generateIndex(QString lang, QWidget *parent=0);

  QString search(QString lang, QString words, QString method="and", int matches=10,
		 QString format="builtin-long", QString sort="score");


protected slots:

  void htdigStdout(KProcess *proc, char *buffer, int buflen);
  void htdigExited(KProcess *proc);
  void htmergeExited(KProcess *proc);
  void htsearchStdout(KProcess *proc, char *buffer, int buflen);
  void htsearchExited(KProcess *proc);


protected:

  QString dataPath(const QString& lang);

  bool saveFilesList(const QString& lang);
  void scanDir(const QString& dir);

  bool createConfig(const QString& lang);


private:

  QStringList   _files;
  KProcess      *_proc;
  int           _filesToDig, _filesDigged, _filesScanned;
  volatile bool _htdigRunning, _htmergeRunning, _htsearchRunning;
  QString       _searchResult;
  ProgressDialog *progress;

};


#endif