summaryrefslogtreecommitdiffstats
path: root/khelpcenter/htmlsearch.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /khelpcenter/htmlsearch.cpp
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'khelpcenter/htmlsearch.cpp')
-rw-r--r--khelpcenter/htmlsearch.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/khelpcenter/htmlsearch.cpp b/khelpcenter/htmlsearch.cpp
new file mode 100644
index 000000000..9c469ae88
--- /dev/null
+++ b/khelpcenter/htmlsearch.cpp
@@ -0,0 +1,61 @@
+#include <kdebug.h>
+#include <kconfig.h>
+
+#include "docentry.h"
+
+#include "htmlsearch.h"
+#include "htmlsearch.moc"
+
+using namespace KHC;
+
+HTMLSearch::HTMLSearch()
+{
+ mConfig = new KConfig("khelpcenterrc", true);
+ mConfig->setGroup( "htdig" );
+}
+
+HTMLSearch::~HTMLSearch()
+{
+ delete mConfig;
+}
+
+void HTMLSearch::setupDocEntry( KHC::DocEntry *entry )
+{
+// kdDebug() << "HTMLSearch::setupDocEntry(): " << entry->name() << endl;
+
+ if ( entry->searchMethod().lower() != "htdig" ) return;
+
+ if ( entry->search().isEmpty() )
+ entry->setSearch( defaultSearch( entry ) );
+ if ( entry->indexer().isEmpty() )
+ entry->setIndexer( defaultIndexer( entry ) );
+ if ( entry->indexTestFile().isEmpty() )
+ entry->setIndexTestFile( defaultIndexTestFile( entry ) );
+
+// entry->dump();
+}
+
+QString HTMLSearch::defaultSearch( KHC::DocEntry *entry )
+{
+ QString htsearch = "cgi:";
+ htsearch += mConfig->readPathEntry( "htsearch" );
+ htsearch += "?words=%k&method=and&format=-desc&config=";
+ htsearch += entry->identifier();
+
+ return htsearch;
+}
+
+QString HTMLSearch::defaultIndexer( KHC::DocEntry * )
+{
+ QString indexer = mConfig->readPathEntry( "indexer" );
+ indexer += " --indexdir=%i %f";
+
+ return indexer;
+}
+
+QString HTMLSearch::defaultIndexTestFile( KHC::DocEntry *entry )
+{
+ return entry->identifier() + ".exists";
+}
+
+// vim:ts=2:sw=2:et