rename some dbus functions and clear up a bit of my own confusion about the locking...
[kdebase.git] / runtime / khelpcenter / searchhandler.h
blobb64825c9461880a426b40f18f34dc287049e0cb8
1 /*
2 This file is part of KHelpCenter.
4 Copyright (c) 2005 Cornelius Schumacher <schumacher@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef KHC_SEARCHHANDLER_H
21 #define KHC_SEARCHHANDLER_H
23 #include "searchengine.h"
25 #include <QObject>
26 #include <KProcess>
28 namespace KIO {
29 class Job;
32 namespace KHC {
34 class SearchJob : public QObject {
35 Q_OBJECT
36 public:
37 SearchJob(DocEntry *entry);
38 ~SearchJob();
40 bool startLocal(const QString &cmdString);
41 bool startRemote(const QString &url);
43 Q_SIGNALS:
44 void searchFinished( SearchJob *, DocEntry *, const QString & );
45 void searchError( SearchJob *, DocEntry *, const QString & );
47 protected Q_SLOTS:
48 void searchExited( int exitCode, QProcess::ExitStatus );
49 void slotJobResult( KJob *job );
50 void slotJobData( KIO::Job *, const QByteArray &data );
52 protected:
53 DocEntry *mEntry;
54 KProcess *mProcess;
55 KIO::Job *mKioJob;
56 QString mCmd;
57 QString mResult;
58 QString mError;
61 class SearchHandler : public QObject
63 Q_OBJECT
64 public:
65 static SearchHandler *initFromFile( const QString &filename );
67 void search( DocEntry *, const QStringList &words,
68 int maxResults = 10,
69 SearchEngine::Operation operation = SearchEngine::And );
71 QString indexCommand( const QString &identifier );
73 QStringList documentTypes() const;
75 bool checkPaths() const;
77 Q_SIGNALS:
78 void searchFinished( SearchHandler *, DocEntry *, const QString & );
79 void searchError( SearchHandler *, DocEntry *, const QString & );
82 protected:
83 bool checkBinary( const QString &cmd ) const;
85 private slots:
86 void searchFinished( SearchJob *, DocEntry *, const QString & );
87 void searchError( SearchJob *, DocEntry *, const QString & );
89 private:
90 SearchHandler();
92 QString mLang;
94 QString mSearchCommand;
95 QString mSearchUrl;
96 QString mIndexCommand;
97 QStringList mDocumentTypes;
102 #endif