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"
35 class SearchJob
: public QObject
{
38 SearchJob(DocEntry
*entry
);
41 bool startLocal(const QString
&cmdString
);
42 bool startRemote(const QString
&url
);
45 void searchFinished( SearchJob
*, DocEntry
*, const QString
& );
46 void searchError( SearchJob
*, DocEntry
*, const QString
& );
49 void searchExited( int exitCode
, QProcess::ExitStatus
);
50 void slotJobResult( KJob
*job
);
51 void slotJobData( KIO::Job
*, const QByteArray
&data
);
62 class SearchHandler
: public QObject
66 static SearchHandler
*initFromFile( const QString
&filename
);
68 virtual ~SearchHandler();
70 virtual void search( DocEntry
*, const QStringList
&words
,
72 SearchEngine::Operation operation
= SearchEngine::And
) = 0;
74 virtual QString
indexCommand( const QString
&identifier
) = 0;
76 QStringList
documentTypes() const;
78 virtual bool checkPaths() const = 0;
81 void searchFinished( SearchHandler
*, DocEntry
*, const QString
& );
82 void searchError( SearchHandler
*, DocEntry
*, const QString
& );
85 SearchHandler( const KConfigGroup
&cg
);
88 QStringList mDocumentTypes
;
91 class ExternalProcessSearchHandler
: public SearchHandler
95 ExternalProcessSearchHandler( const KConfigGroup
&cg
);
97 void search( DocEntry
*, const QStringList
&words
,
99 SearchEngine::Operation operation
= SearchEngine::And
);
101 QString
indexCommand( const QString
&identifier
);
103 bool checkPaths() const;
106 bool checkBinary( const QString
&cmd
) const;
109 void slotSearchFinished( SearchJob
*, DocEntry
*, const QString
& );
110 void slotSearchError( SearchJob
*, DocEntry
*, const QString
& );
113 QString mSearchCommand
;
115 QString mIndexCommand
;