Commit 16313376 authored by Pino Toscano's avatar Pino Toscano

Remove the ht://dig support

ht://dig is basically unmantained for the past decade, and its
integration in khelpcenter has always been a sort of hack (execute
a CGI, and print its resulting HTML text).

Since Xapian is used as better solution, all of the htp://dig
supporting code can be removed completely.

CCBUG: 103266
CCBUG: 112958
BUG: 122437
BUG: 125276
BUG: 152671
BUG: 158633
BUG: 209415
BUG: 244091
BUG: 255384
BUG: 256397
BUG: 277464
parent 583ed246
......@@ -84,13 +84,11 @@ set(khelpcenter_KDEINIT_SRCS
toc.cpp
mainwindow.cpp
docentry.cpp
htmlsearch.cpp
history.cpp
application.cpp
treebuilder.cpp
infotree.cpp
kcmhelpcenter.cpp
htmlsearchconfig.cpp
fontdialog.cpp
plugintraverser.cpp
scrollkeepertreebuilder.cpp
......
To make use of the full-text search function in khelpcenter,
you need ht://dig.
ht://dig is a HTML indexing and searching tool.
You can get it from http://www.htdig.org.
NOTE: If you install htdig from source, make sure
that you put the 'htsearch' as well as the 'htdig'
and 'htmerge' binaries into your PATH.
Per default, 'htsearch' goes to some cgi-bin
directory.
......@@ -355,20 +355,6 @@ including <command>gcc</command> (the C/C++ compiler),
<sect3 id="search">
<title>The <guilabel>Search</guilabel> tab</title>
<para>
Searching requires you have the <application>ht://Dig</application>
application installed. Information on installing and configuring the
search index is available in the document. Configuration of the search
index is performed in the &kcontrol;, by choosing
<menuchoice><guisubmenu>Help</guisubmenu><guimenuitem>Index</guimenuitem></menuchoice>,
and detailed help is available from this module.
</para>
<para>
For the purposes of this document, we'll assume you already have this set
up and configured.
</para>
<para>
Searching the help files is fairly intuitive, enter the word(s) you wish
to search for in the text box, choose your options (if any), and press
......
......@@ -26,7 +26,6 @@
#include <KConfig>
#include <KConfigGroup>
#include "htmlsearch.h"
#include "docentrytraverser.h"
#include <KLocalizedString>
......@@ -46,8 +45,6 @@ DocMetaInfo::DocMetaInfo()
{
qDebug() << "DocMetaInfo()";
mHtmlSearch = new HTMLSearch;
mRootEntry.setName( i18n("Top-Level Documentation") );
}
......@@ -61,8 +58,6 @@ DocMetaInfo::~DocMetaInfo()
delete *it;
}
delete mHtmlSearch;
mLoaded = false;
mSelf = 0;
......@@ -97,10 +92,6 @@ DocEntry *DocMetaInfo::addDocEntry( const QString &fileName )
entry->name() ,
mLanguageNames[ lang ] ) );
}
if ( entry->searchMethod().toLower() == "htdig" )
{
mHtmlSearch->setupDocEntry( entry );
}
QString indexer = entry->indexer();
indexer.replace( "%f", fileName );
entry->setIndexer( indexer );
......
......@@ -28,7 +28,6 @@
namespace KHC {
class HTMLSearch;
class DocEntryTraverser;
/*!
......@@ -84,8 +83,6 @@ namespace KHC {
QMap<QString,QString> mLanguageNames;
HTMLSearch *mHtmlSearch;
static bool mLoaded;
static DocMetaInfo *mSelf;
......
#include "htmlsearch.h"
#include <KConfig>
#include <KConfigGroup>
#include "docentry.h"
using namespace KHC;
HTMLSearch::HTMLSearch()
{
mConfig = new KConfig("khelpcenterrc");
}
HTMLSearch::~HTMLSearch()
{
delete mConfig;
}
void HTMLSearch::setupDocEntry( KHC::DocEntry *entry )
{
// kDebug() << "HTMLSearch::setupDocEntry(): " << entry->name();
if ( entry->searchMethod().toLower() != QLatin1String("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 = QLatin1String("cgi:");
htsearch += mConfig->group("htdig").readPathEntry( "htsearch", QString() );
htsearch += "?words=%k&method=and&format=-desc&config=";
htsearch += entry->identifier();
return htsearch;
}
QString HTMLSearch::defaultIndexer( KHC::DocEntry * )
{
QString indexer = mConfig->group("htdig").readPathEntry( "indexer", QString() );
indexer += " --indexdir=%i %f";
return indexer;
}
QString HTMLSearch::defaultIndexTestFile( KHC::DocEntry *entry )
{
return entry->identifier() + QLatin1String(".exists");
}
// vim:ts=2:sw=2:et
/* This file is part of the KDE project
Copyright 2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License version 2 or at your option version 3 as published
by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KHC_HTMLSEARCH_H
#define KHC_HTMLSEARCH_H
#include <QObject>
class KConfig;
namespace KHC {
class DocEntry;
class HTMLSearch : public QObject
{
Q_OBJECT
public:
HTMLSearch();
~HTMLSearch();
void setupDocEntry( KHC::DocEntry * );
QString defaultSearch( KHC::DocEntry * );
QString defaultIndexer( KHC::DocEntry * );
QString defaultIndexTestFile( KHC::DocEntry * );
private:
KConfig *mConfig;
};
}
#endif //KHC_HTMLSEARCH_H
// vim:ts=2:sw=2:et
########### next target ###############
set(htmlsearch_LIB_SRCS htmlsearch.cpp progressdialog.cpp)
add_library(htmlsearch SHARED ${htmlsearch_LIB_SRCS})
target_link_libraries(htmlsearch KF5::KIOWidgets)
set_target_properties(htmlsearch PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
install(TARGETS htmlsearch ${INSTALL_TARGETS_DEFAULT_ARGS})
########### next target ###############
set(kcm_htmlsearch_LIB_SRCS kcmhtmlsearch.cpp klangcombo.cpp ktagcombobox.cpp)
add_library(kcm_htmlsearch SHARED ${kcm_htmlsearch_LIB_SRCS})
target_link_libraries(kcm_htmlsearch KF5::KIOWidgets)
set_target_properties(kcm_htmlsearch PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
install(TARGETS kcm_htmlsearch ${INSTALL_TARGETS_DEFAULT_ARGS})
########### next target ###############
add_executable(khtmlindex index.cpp)
target_link_libraries(khtmlindex KF5::KDELibs4Support htmlsearch )
install(PROGRAMS khtmlindex ${INSTALL_TARGETS_DEFAULT_ARGS})
########### install files ###############
install( FILES htmlsearch.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES long.html short.html wrapper.html nomatch.html syntax.html DESTINATION ${DATA_INSTALL_DIR}/khelpcenter/en )
install( FILES star.png star_blank.png DESTINATION ${DATA_INSTALL_DIR}/khelpcenter/pics )
install( FILES unchecked.xpm checked.xpm DESTINATION ${DATA_INSTALL_DIR}/khelpcenter/pics )
install( PROGRAMS meinproc_wrapper DESTINATION ${DATA_INSTALL_DIR}/khelpcenter/ )
ecm_install_icons( ${DATA_INSTALL_DIR}/khelpcenter/ )
#! /usr/bin/env bash
exit 0 # htmlsearch is not built and deprecated
### TODO: why do we need 2 POT files for one directory?
$XGETTEXT index.cpp htmlsearch.cpp progressdialog.cpp rc.cpp -o $podir/htmlsearch.pot
$XGETTEXT kcmhtmlsearch.cpp klangcombo.cpp ktagcombobox.cpp rc.cpp -o $podir/kcmhtmlsearch.pot
/* XPM */
static char*unchecked[]={
"16 16 4 1",
"# c #000000",
"+ c #ffffff",
"D c #000000",
". c None",
"................",
"............++++",
"..++++++++++DDD+",
"..+########DDD+.",
"..+#++++++DDD+..",
"+DDD+...+DDD#+..",
"++DDD+++DDD+#+..",
"..+DDDDDDD++#+..",
"..+#DDDDD+.+#+..",
"..+#++DD+..+#+..",
"..+#+++++..+#+..",
"..+#++++++++#+..",
"..+##########+..",
"..++++++++++++..",
"................",
"................"};
This diff is collapsed.
This diff is collapsed.
#ifndef __HTMLSEARCH_H__
#define __HTMLSEARCH_H__
class QWidget;
class K3Process;
class ProgressDialog;
class HTMLSearch : public QObject
{
Q_OBJECT
public:
HTMLSearch();
bool generateIndex(const QString & lang, QWidget *parent=0);
QString search(const QString & lang, const QString & words, const QString & method="and", int matches=10,
const QString & format="builtin-long", const QString & sort="score");
protected Q_SLOTS:
void htdigStdout(K3Process *proc, char *buffer, int buflen);
void htdigExited(K3Process *proc);
void htmergeExited(K3Process *proc);
void htsearchStdout(K3Process *proc, char *buffer, int buflen);
void htsearchExited(K3Process *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;
K3Process *_proc;
int _filesToDig, _filesDigged, _filesScanned;
volatile bool _htdigRunning, _htmergeRunning, _htsearchRunning;
QString _searchResult;
ProgressDialog *progress;
};
#endif
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include "htmlsearch.h"
int main(int argc, char *argv[])
{
KAboutData aboutData( "khtmlindex", "htmlsearch", ki18n("KHtmlIndex"),
"",
ki18n("KDE Index generator for help files."));
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
options.add("lang <lang>", ki18n("The language to index"), "en");
KCmdLineArgs::addCmdLineOptions( options );
KApplication app;
HTMLSearch search;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
search.generateIndex(args->getOption("lang"));
}
This diff is collapsed.
/**
* kcmhtmlsearch.h
*
* Copyright (c) 2000 Matthias Hölzer-Klüpfel <hoelzer@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __kcmhtmlsearch_h__
#define __kcmhtmlsearch_h__
#define KDE3_SUPPORT
#include <kcmodule.h>
#undef KDE3_SUPPORT
#include <QVariantList>
class QCheckBox;
class QPushButton;
class QListWidget;
class K3Process;
class KLanguageCombo;
class KUrlRequester;
class QStringList;
class KHTMLSearchConfig : public KCModule
{
Q_OBJECT
public:
KHTMLSearchConfig(QWidget *parent, const QVariantList &args);
virtual ~KHTMLSearchConfig();
void load();
void save();
void defaults();
QString quickHelp() const;
int buttons();
protected Q_SLOTS:
void configChanged();
void addClicked();
void delClicked();
void pathSelected(const QString &);
void urlClicked(const QString&);
void generateIndex();
void indexTerminated(K3Process *proc);
private:
void checkButtons();
void loadLanguages();
KUrlRequester *htdigBin, *htsearchBin, *htmergeBin;
QCheckBox *indexKDE, *indexMan, *indexInfo;
QPushButton *addButton, *delButton, *runButton;
QListWidget *searchPaths;
KLanguageCombo *language;
K3Process *indexProc;
};
#endif
/*
* klangcombo.cpp - Adds some methods for inserting languages.
*
* Copyright (c) 1999-2000 Hans Petter Bieker <bieker@kde.org>
*
* Requires the Qt widget libraries, available at no cost at
* http://www.troll.no/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "klangcombo.h"
KLanguageCombo::~KLanguageCombo ()
{
}
KLanguageCombo::KLanguageCombo (QWidget * parent, const char *name)
: KTagComboBox(parent, name)
{
}
void KLanguageCombo::insertLanguage(const QString& path, const QString& name, const QString& sub, const QString &submenu, int index)
{
QString output = name + QLatin1String(" (") + path + QString::fromLatin1(")");
QPixmap flag(locate("locale", sub + path + QLatin1String("/flag.png")));
insertItem(QIcon(flag), output, path, submenu, index);
}
void KLanguageCombo::changeLanguage(const QString& name, int i)
{
if (i < 0 || i >= count()) return;
QString output = name + QLatin1String(" (") + tag(i) + QString::fromLatin1(")");
changeItem(output, i);
}
/*
* klangcombo.h - Adds some methods for inserting languages.
*
* Copyright (c) 1999-2000 Hans Petter Bieker <bieker@kde.org>
*
* Requires the Qt widget libraries, available at no cost at
* http://www.troll.no/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KLANGCOMBO_H__
#define __KLANGCOMBO_H__
#include "ktagcombobox.h"
/*
* Extends KTagCombo to support adding and changing languages.
*
* It has also support for sub menus.
*/
class KLanguageCombo : public KTagComboBox
{
Q_OBJECT
public:
explicit KLanguageCombo(QWidget *parent=0, const char *name=0);
~KLanguageCombo();
void insertLanguage(const QString& path, const QString& name, const QString& sub = QString(), const QString &submenu = QString(), int index = -1);
void changeLanguage(const QString& name, int i);
};
#endif
/*
* ktagcombobox.cpp - A combobox with support for submenues, icons and tags
*
* Copyright (c) 1999-2000 Hans Petter Bieker <bieker@kde.org>
*
* Requires the Qt widget libraries, available at no cost at
* http://www.troll.no/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#define INCLUDE_MENUITEM_DEF 1
#include "ktagcombobox.h"
#include <QPainter>
#include <QDebug>
KTagComboBox::~KTagComboBox ()
{
delete popup;
}
KTagComboBox::KTagComboBox (QWidget * parent, const char *name)
: QComboBox(parent, name),
popup(0),
old_popup(0)
{
clear();
}
void KTagComboBox::popupMenu()
{
popup->popup( mapToGlobal( QPoint(0,0) ), current );
}
void KTagComboBox::keyPressEvent( QKeyEvent *e )
{
int c;
if ( ( e->key() == Key_F4 && e->state() == 0 ) ||
( e->key() == Key_Down && (e->state() & AltButton) ) ||
( e->key() == Key_Space ) ) {
if ( count() ) {
popup->setActiveItem( current );
popupMenu();
}
return;
} else {
e->ignore();
return;
}
c = currentItem();
emit highlighted( c );
emit activated( c );
}
void KTagComboBox::mousePressEvent( QMouseEvent * )
{
popupMenu();
} </