1 #include "htmlsearch.h"
5 #include <kconfiggroup.h>
9 #include "htmlsearch.moc"
13 HTMLSearch::HTMLSearch()
15 mConfig
= new KConfig("khelpcenterrc");
18 HTMLSearch::~HTMLSearch()
23 void HTMLSearch::setupDocEntry( KHC::DocEntry
*entry
)
25 // kDebug() << "HTMLSearch::setupDocEntry(): " << entry->name();
27 if ( entry
->searchMethod().toLower() != QLatin1String("htdig") ) return;
29 if ( entry
->search().isEmpty() )
30 entry
->setSearch( defaultSearch( entry
) );
31 if ( entry
->indexer().isEmpty() )
32 entry
->setIndexer( defaultIndexer( entry
) );
33 if ( entry
->indexTestFile().isEmpty() )
34 entry
->setIndexTestFile( defaultIndexTestFile( entry
) );
39 QString
HTMLSearch::defaultSearch( KHC::DocEntry
*entry
)
41 QString htsearch
= QLatin1String("cgi:");
42 htsearch
+= mConfig
->group("htdig").readPathEntry( "htsearch", QString() );
43 htsearch
+= "?words=%k&method=and&format=-desc&config=";
44 htsearch
+= entry
->identifier();
49 QString
HTMLSearch::defaultIndexer( KHC::DocEntry
* )
51 QString indexer
= mConfig
->group("htdig").readPathEntry( "indexer", QString() );
52 indexer
+= " --indexdir=%i %f";
57 QString
HTMLSearch::defaultIndexTestFile( KHC::DocEntry
*entry
)
59 return entry
->identifier() + QLatin1String(".exists");