summaryrefslogtreecommitdiffstats
path: root/khelpcenter/htmlsearch
diff options
context:
space:
mode:
Diffstat (limited to 'khelpcenter/htmlsearch')
-rw-r--r--khelpcenter/htmlsearch/Makefile.am39
-rw-r--r--khelpcenter/htmlsearch/checked.xpm23
-rw-r--r--khelpcenter/htmlsearch/htmlsearch.cpp487
-rw-r--r--khelpcenter/htmlsearch/htmlsearch.desktop239
-rw-r--r--khelpcenter/htmlsearch/htmlsearch.h64
-rw-r--r--khelpcenter/htmlsearch/index.cpp31
-rw-r--r--khelpcenter/htmlsearch/kcmhtmlsearch.cpp370
-rw-r--r--khelpcenter/htmlsearch/kcmhtmlsearch.h81
-rw-r--r--khelpcenter/htmlsearch/klangcombo.cpp52
-rw-r--r--khelpcenter/htmlsearch/klangcombo.h47
-rw-r--r--khelpcenter/htmlsearch/ktagcombobox.cpp252
-rw-r--r--khelpcenter/htmlsearch/ktagcombobox.h92
-rw-r--r--khelpcenter/htmlsearch/long.html6
-rw-r--r--khelpcenter/htmlsearch/meinproc_wrapper4
-rw-r--r--khelpcenter/htmlsearch/nomatch.html21
-rw-r--r--khelpcenter/htmlsearch/progressdialog.cpp76
-rw-r--r--khelpcenter/htmlsearch/progressdialog.h35
-rw-r--r--khelpcenter/htmlsearch/short.html1
-rw-r--r--khelpcenter/htmlsearch/star.pngbin0 -> 690 bytes
-rw-r--r--khelpcenter/htmlsearch/star_blank.pngbin0 -> 151 bytes
-rw-r--r--khelpcenter/htmlsearch/syntax.html19
-rw-r--r--khelpcenter/htmlsearch/unchecked.xpm22
-rw-r--r--khelpcenter/htmlsearch/wrapper.html16
23 files changed, 1977 insertions, 0 deletions
diff --git a/khelpcenter/htmlsearch/Makefile.am b/khelpcenter/htmlsearch/Makefile.am
new file mode 100644
index 000000000..f287fa11e
--- /dev/null
+++ b/khelpcenter/htmlsearch/Makefile.am
@@ -0,0 +1,39 @@
+khelpcenter_en_data_DATA = long.html short.html wrapper.html nomatch.html syntax.html
+khelpcenter_en_datadir = $(kde_datadir)/khelpcenter/en
+
+star_DATA = star.png star_blank.png
+stardir = $(kde_datadir)/khelpcenter/pics
+
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+
+lib_LTLIBRARIES = libhtmlsearch.la libkcm_htmlsearch.la
+
+libhtmlsearch_la_SOURCES = htmlsearch.cpp progressdialog.cpp
+libhtmlsearch_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
+libhtmlsearch_la_LIBADD = $(LIB_KIO)
+
+libkcm_htmlsearch_la_SOURCES = kcmhtmlsearch.cpp klangcombo.cpp ktagcombobox.cpp
+libkcm_htmlsearch_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
+libkcm_htmlsearch_la_LIBADD = $(LIB_KIO)
+
+noinst_HEADERS = kcmhtmlsearch.h htmlsearch.h
+
+xdg_apps_DATA = htmlsearch.desktop
+
+bin_PROGRAMS = khtmlindex
+
+wrapperdir = $(kde_datadir)/khelpcenter/
+wrapper_SCRIPTS = meinproc_wrapper
+
+khtmlindex_SOURCES = index.cpp
+khtmlindex_LDFLAGS = $(KDE_RPATH) $(all_libraries)
+khtmlindex_LDADD = libhtmlsearch.la $(LIB_KDEUI)
+
+xpm_DATA = unchecked.xpm checked.xpm
+xpmdir = $(kde_datadir)/khelpcenter/pics
+
+messages:
+ $(XGETTEXT) index.cpp $(libhtmlsearch_la_SOURCES) -o $(podir)/htmlsearch.pot
+ $(XGETTEXT) $(libkcm_htmlsearch_la_SOURCES) -o $(podir)/kcmhtmlsearch.pot
+
diff --git a/khelpcenter/htmlsearch/checked.xpm b/khelpcenter/htmlsearch/checked.xpm
new file mode 100644
index 000000000..1ed190249
--- /dev/null
+++ b/khelpcenter/htmlsearch/checked.xpm
@@ -0,0 +1,23 @@
+/* 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+..+#+..",
+"..+#+++++..+#+..",
+"..+#++++++++#+..",
+"..+##########+..",
+"..++++++++++++..",
+"................",
+"................"};
diff --git a/khelpcenter/htmlsearch/htmlsearch.cpp b/khelpcenter/htmlsearch/htmlsearch.cpp
new file mode 100644
index 000000000..02d09d142
--- /dev/null
+++ b/khelpcenter/htmlsearch/htmlsearch.cpp
@@ -0,0 +1,487 @@
+#include <qregexp.h>
+#include <qdir.h>
+#include <assert.h>
+
+#include <kapplication.h>
+#include <kdebug.h>
+#include <kstandarddirs.h>
+#include <kprocess.h>
+#include <klocale.h>
+#include <kconfig.h>
+
+
+#include "progressdialog.h"
+#include "htmlsearch.moc"
+
+
+HTMLSearch::HTMLSearch()
+ : QObject(), _proc(0)
+{
+}
+
+
+QString HTMLSearch::dataPath(const QString& _lang)
+{
+ return kapp->dirs()->saveLocation("data", QString("khelpcenter/%1").arg(_lang));
+}
+
+
+void HTMLSearch::scanDir(const QString& dir)
+{
+ assert( dir.at( dir.length() - 1 ) == '/' );
+
+ QStringList::ConstIterator it;
+
+ if ( KStandardDirs::exists( dir + "index.docbook" ) ) {
+ _files.append(dir + "index.docbook");
+ progress->setFilesScanned(++_filesScanned);
+ } else {
+ QDir d(dir, "*.html", QDir::Name|QDir::IgnoreCase, QDir::Files | QDir::Readable);
+ QStringList const &list = d.entryList();
+ QString adir = d.canonicalPath () + "/";
+ QString file;
+ for (it=list.begin(); it != list.end(); ++it)
+ {
+ file = adir + *it;
+ if ( !_files.contains( file ) ) {
+ _files.append(file);
+ progress->setFilesScanned(++_filesScanned);
+ }
+ }
+ }
+
+ QDir d2(dir, QString::null, QDir::Name|QDir::IgnoreCase, QDir::Dirs);
+ QStringList const &dlist = d2.entryList();
+ for (it=dlist.begin(); it != dlist.end(); ++it)
+ if (*it != "." && *it != "..")
+ {
+ scanDir(dir + *it + "/");
+ kapp->processEvents();
+ }
+}
+
+
+bool HTMLSearch::saveFilesList(const QString& _lang)
+{
+ QStringList dirs;
+
+ // throw away old files list
+ _files.clear();
+
+ // open config file
+ KConfig *config = new KConfig("khelpcenterrc");
+ config->setGroup("Scope");
+
+ // add KDE help dirs
+ if (config->readBoolEntry("KDE", true))
+ dirs = kapp->dirs()->findDirs("html", _lang + "/");
+ kdDebug() << "got " << dirs.count() << " dirs\n";
+
+ // TODO: Man and Info!!
+
+ // add local urls
+ QStringList add = config->readListEntry("Paths");
+ QStringList::Iterator it;
+ for (it = add.begin(); it != add.end(); ++it) {
+ if ( ( *it ).at( ( *it ).length() - 1 ) != '/' )
+ ( *it ) += '/';
+ dirs.append(*it);
+ }
+
+ _filesScanned = 0;
+
+ for (it = dirs.begin(); it != dirs.end(); ++it)
+ scanDir(*it);
+
+ delete config;
+
+ return true;
+}
+
+
+bool HTMLSearch::createConfig(const QString& _lang)
+{
+ QString fname = dataPath(_lang) + "/htdig.conf";
+
+ // locate the common dir
+ QString wrapper = locate("data", QString("khelpcenter/%1/wrapper.html").arg(_lang));
+ if (wrapper.isEmpty())
+ wrapper = locate("data", QString("khelpcenter/en/wrapper.html"));
+ if (wrapper.isEmpty())
+ return false;
+ wrapper = wrapper.left(wrapper.length() - 12);
+
+ // locate the image dir
+ QString images = locate("data", "khelpcenter/pics/star.png");
+ if (images.isEmpty())
+ return false;
+ images = images.left(images.length() - 8);
+
+ // This is an example replacement for the default bad_words file
+ // distributed with ht://Dig. It was compiled by Marjolein Katsma
+ // <HSH@taxon.demon.nl>.
+ QString bad_words = i18n( "List of words to exclude from index",
+ "above:about:according:across:actually:\n"
+ "adj:after:afterwards:again:against:all:\n"
+ "almost:alone:along:already:also:although:\n"
+ "always:among:amongst:and:another:any:\n"
+ "anyhow:anyone:anything:anywhere:are:aren:\n"
+ "arent:around:became:because:become:\n"
+ "becomes:becoming:been:before:beforehand:\n"
+ "begin:beginning:behind:being:below:beside:\n"
+ "besides:between:beyond:billion:both:but:\n"
+ "can:cant:cannot:caption:could:couldnt:\n"
+ "did:didnt:does:doesnt:dont:down:during:\n"
+ "each:eight:eighty:either:else:elsewhere:\n"
+ "end:ending:enough:etc:even:ever:every:\n"
+ "everyone:everything:everywhere:except:few:\n"
+ "fifty:first:five:for:former:formerly:forty:\n"
+ "found:four:from:further:had:has:hasnt:have:\n"
+ "havent:hence:her:here:hereafter:hereby:\n"
+ "herein:heres:hereupon:hers:herself:hes:him:\n"
+ "himself:his:how:however:hundred:\n"
+ "inc:indeed:instead:into:isnt:its:\n"
+ "itself:last:later:latter:latterly:least:\n"
+ "less:let:like:likely:ltd:made:make:makes:\n"
+ "many:may:maybe:meantime:meanwhile:might:\n"
+ "million:miss:more:moreover:most:mostly:\n"
+ "mrs:much:must:myself:namely:neither:\n"
+ "never:nevertheless:next:nine:ninety:\n"
+ "nobody:none:nonetheless:noone:nor:not:\n"
+ "nothing:now:nowhere:off:often:once:\n"
+ "one:only:onto:others:otherwise:our:ours:\n"
+ "ourselves:out:over:overall:own:page:per:\n"
+ "perhaps:rather:recent:recently:same:\n"
+ "seem:seemed:seeming:seems:seven:seventy:\n"
+ "several:she:shes:should:shouldnt:since:six:\n"
+ "sixty:some:somehow:someone:something:\n"
+ "sometime:sometimes:somewhere:still:stop:\n"
+ "such:taking:ten:than:that:the:their:them:\n"
+ "themselves:then:thence:there:thereafter:\n"
+ "thereby:therefore:therein:thereupon:these:\n"
+ "they:thirty:this:those:though:thousand:\n"
+ "three:through:throughout:thru:thus:tips:\n"
+ "together:too:toward:towards:trillion:\n"
+ "twenty:two:under:unless:unlike:unlikely:\n"
+ "until:update:updated:updates:upon:\n"
+ "used:using:very:via:want:wanted:wants:\n"
+ "was:wasnt:way:ways:wed:well:were:\n"
+ "werent:what:whats:whatever:when:whence:\n"
+ "whenever:where:whereafter:whereas:whereby:\n"
+ "wherein:whereupon:wherever:wheres:whether:\n"
+ "which:while:whither:who:whoever:whole:\n"
+ "whom:whomever:whose:why:will:with:within:\n"
+ "without:wont:work:worked:works:working:\n"
+ "would:wouldnt:yes:yet:you:youd:youll:your:\n"
+ "youre:yours:yourself:yourselves:youve" );
+
+ QFile f;
+ f.setName( dataPath(_lang) + "/bad_words" );
+ if (f.open(IO_WriteOnly))
+ {
+ QTextStream ts( &f );
+ QStringList words = QStringList::split ( QRegExp ( "[\n:]" ),
+ bad_words, false);
+ for ( QStringList::ConstIterator it = words.begin();
+ it != words.end(); ++it )
+ ts << *it << endl;
+ f.close();
+ }
+
+ f.setName(fname);
+ if (f.open(IO_WriteOnly))
+ {
+ kdDebug() << "Writing config for " << _lang << " to " << fname << endl;
+
+ QTextStream ts(&f);
+
+ ts << "database_dir:\t\t" << dataPath(_lang) << endl;
+ ts << "start_url:\t\t`" << dataPath(_lang) << "/files`" << endl;
+ ts << "local_urls:\t\tfile:/=/" << endl;
+ ts << "local_urls_only:\ttrue" << endl;
+ ts << "maximum_pages:\t\t1" << endl;
+ ts << "image_url_prefix:\t" << images << endl;
+ ts << "star_image:\t\t" << images << "star.png" << endl;
+ ts << "star_blank:\t\t" << images << "star_blank.png" << endl;
+ ts << "compression_level:\t6" << endl;
+ ts << "max_hop_count:\t\t0" << endl;
+
+ ts << "search_results_wrapper:\t" << wrapper << "wrapper.html" << endl;
+ ts << "nothing_found_file:\t" << wrapper << "nomatch.html" << endl;
+ ts << "syntax_error_file:\t" << wrapper << "syntax.html" << endl;
+ ts << "bad_word_list:\t\t" << dataPath(_lang) << "/bad_words" << endl;
+ ts << "external_parsers:\t" << "text/xml\t" << locate( "data", "khelpcenter/meinproc_wrapper" ) << endl;
+ f.close();
+ return true;
+ }
+
+ return false;
+}
+
+
+#define CHUNK_SIZE 15
+
+bool HTMLSearch::generateIndex(QString _lang, QWidget *parent)
+{
+ if (_lang == "C")
+ _lang = "en";
+
+ if (!createConfig(_lang))
+ return false;
+
+ // create progress dialog
+ progress = new ProgressDialog(parent);
+ progress->show();
+ kapp->processEvents();
+
+ // create files list ----------------------------------------------
+ if (!saveFilesList(_lang))
+ return false;
+
+ progress->setState(1);
+
+ // run htdig ------------------------------------------------------
+ KConfig *config = new KConfig("khelpcenterrc", true);
+ KConfigGroupSaver saver(config, "htdig");
+ QString exe = config->readPathEntry("htdig", kapp->dirs()->findExe("htdig"));
+
+ if (exe.isEmpty())
+ {
+ delete config;
+ return false;
+ }
+ bool initial = true;
+ bool done = false;
+ int count = 0;
+
+ _filesToDig = _files.count();
+ progress->setFilesToDig(_filesToDig);
+ _filesDigged = 0;
+
+ QDir d; d.mkdir(dataPath(_lang));
+
+ while (!done)
+ {
+ // kill old process
+ delete _proc;
+
+ // prepare new process
+ _proc = new KProcess();
+ *_proc << exe << "-v" << "-c" << dataPath(_lang)+"/htdig.conf";
+ if (initial)
+ {
+ *_proc << "-i";
+ initial = false;
+ }
+
+ kdDebug() << "Running htdig" << endl;
+
+ connect(_proc, SIGNAL(receivedStdout(KProcess *,char*,int)),
+ this, SLOT(htdigStdout(KProcess *,char*,int)));
+
+ connect(_proc, SIGNAL(processExited(KProcess *)),
+ this, SLOT(htdigExited(KProcess *)));
+
+ _htdigRunning = true;
+
+ // write out file
+ QFile f(dataPath(_lang)+"/files");
+ if (f.open(IO_WriteOnly))
+ {
+ QTextStream ts(&f);
+
+ for (int i=0; i<CHUNK_SIZE; ++i, ++count)
+ if (count < _filesToDig) {
+ ts << "file://" + _files[count] << endl;
+ } else {
+ done = true;
+ break;
+ }
+ f.close();
+ }
+ else
+ {
+ kdDebug() << "Could not open `files` for writing" << endl;
+ delete config;
+ return false;
+ }
+
+
+ // execute htdig
+ _proc->start(KProcess::NotifyOnExit, KProcess::Stdout );
+
+ kapp->enter_loop();
+
+ if (!_proc->normalExit() || _proc->exitStatus() != 0)
+ {
+ delete _proc;
+ delete progress;
+ delete config;
+ return false;
+ }
+
+ // _filesDigged += CHUNK_SIZE;
+ progress->setFilesDigged(_filesDigged);
+ kapp->processEvents();
+ }
+
+ progress->setState(2);
+
+ // run htmerge -----------------------------------------------------
+ exe = config->readPathEntry("htmerge", kapp->dirs()->findExe("htmerge"));
+ if (exe.isEmpty())
+ {
+ delete config;
+ return false;
+ }
+ delete _proc;
+ _proc = new KProcess();
+ *_proc << exe << "-c" << dataPath(_lang)+"/htdig.conf";
+
+ kdDebug() << "Running htmerge" << endl;
+
+ connect(_proc, SIGNAL(processExited(KProcess *)),
+ this, SLOT(htmergeExited(KProcess *)));
+
+ _htmergeRunning = true;
+
+ _proc->start(KProcess::NotifyOnExit, KProcess::Stdout);
+
+ kapp->enter_loop();
+
+ if (!_proc->normalExit() || _proc->exitStatus() != 0)
+ {
+ delete _proc;
+ delete progress;
+ delete config;
+ return false;
+ }
+
+ delete _proc;
+
+ progress->setState(3);
+ kapp->processEvents();
+
+ delete progress;
+ delete config;
+
+ return true;
+}
+
+
+
+void HTMLSearch::htdigStdout(KProcess *, char *buffer, int len)
+{
+ QString line = QString(buffer).left(len);
+
+ int cnt=0, index=-1;
+ while ( (index = line.find("file://", index+1)) > 0)
+ cnt++;
+ _filesDigged += cnt;
+
+ cnt=0;
+ index=-1;
+ while ( (index = line.find("not changed", index+1)) > 0)
+ cnt++;
+ _filesDigged -= cnt;
+
+ progress->setFilesDigged(_filesDigged);
+}
+
+
+void HTMLSearch::htdigExited(KProcess *p)
+{
+ kdDebug() << "htdig terminated " << p->exitStatus() << endl;
+ _htdigRunning = false;
+ kapp->exit_loop();
+}
+
+
+void HTMLSearch::htmergeExited(KProcess *)
+{
+ kdDebug() << "htmerge terminated" << endl;
+ _htmergeRunning = false;
+ kapp->exit_loop();
+}
+
+
+void HTMLSearch::htsearchStdout(KProcess *, char *buffer, int len)
+{
+ _searchResult += QString::fromLocal8Bit(buffer,len);
+}
+
+
+void HTMLSearch::htsearchExited(KProcess *)
+{
+ kdDebug() << "htsearch terminated" << endl;
+ _htsearchRunning = false;
+ kapp->exit_loop();
+}
+
+
+QString HTMLSearch::search(QString _lang, QString words, QString method, int matches,
+ QString format, QString sort)
+{
+ if (_lang == "C")
+ _lang = "en";
+
+ createConfig(_lang);
+
+ QString result = dataPath(_lang)+"/result.html";
+
+ // run htsearch ----------------------------------------------------
+ KConfig *config = new KConfig("khelpcenterrc", true);
+ KConfigGroupSaver saver(config, "htdig");
+ QString exe = config->readPathEntry("htsearch", kapp->dirs()->findExe("htsearch"));
+ if (exe.isEmpty())
+ {
+ delete config;
+ return QString::null;
+ }
+ _proc = new KProcess();
+ *_proc << exe << "-c" << dataPath(_lang)+"/htdig.conf" <<
+ QString("words=%1;method=%2;matchesperpage=%3;format=%4;sort=%5").arg(words).arg(method).arg(matches).arg(format).arg(sort);
+
+ kdDebug() << "Running htsearch" << endl;
+
+ connect(_proc, SIGNAL(receivedStdout(KProcess *,char*,int)),
+ this, SLOT(htsearchStdout(KProcess *,char*,int)));
+ connect(_proc, SIGNAL(processExited(KProcess *)),
+ this, SLOT(htsearchExited(KProcess *)));
+
+ _htsearchRunning = true;
+ _searchResult = "";
+
+ _proc->start(KProcess::NotifyOnExit, KProcess::Stdout);
+
+ kapp->enter_loop();
+
+ if (!_proc->normalExit() || _proc->exitStatus() != 0)
+ {
+ kdDebug() << "Error running htsearch... returning now" << endl;
+ delete _proc;
+ delete config;
+ return QString::null;
+ }
+
+ delete _proc;
+
+ // modify the search result
+ _searchResult = _searchResult.replace("http://localhost/", "file:/");
+ _searchResult = _searchResult.replace("Content-type: text/html", QString::null);
+
+ // dump the search result
+ QFile f(result);
+ if (f.open(IO_WriteOnly))
+ {
+ QTextStream ts(&f);
+
+ ts << _searchResult << endl;
+
+ f.close();
+ delete config;
+ return result;
+ }
+ delete config;
+ return QString::null;
+}
diff --git a/khelpcenter/htmlsearch/htmlsearch.desktop b/khelpcenter/htmlsearch/htmlsearch.desktop
new file mode 100644
index 000000000..1879ae742
--- /dev/null
+++ b/khelpcenter/htmlsearch/htmlsearch.desktop
@@ -0,0 +1,239 @@
+[Desktop Entry]
+Exec=kcmshell htmlsearch
+Icon=help_index
+Type=Application
+DocPath=kcontrol/help-index.html
+
+X-KDE-ModuleType=Library
+X-KDE-Library=htmlsearch
+X-KDE-FactoryName=htmlsearch
+X-KDE-ControlModuleType=User
+
+Name=Index
+Name[af]=Indeks
+Name[ar]=الفهرس
+Name[az]=İndeks
+Name[be]=Індэкс
+Name[bg]=Индекс
+Name[bn]=সূচি
+Name[br]=Meneger
+Name[bs]=Indeks
+Name[ca]=Índex
+Name[cs]=Rejstřík
+Name[csb]=Indeks
+Name[cy]=Mynegai
+Name[da]=Indeks
+Name[de]=Stichwortverzeichnis
+Name[el]=Ευρετήριο
+Name[eo]=Indekso
+Name[es]=Índice
+Name[et]=Indeks
+Name[eu]=Indizea
+Name[fa]=نمایه
+Name[fi]=Hakemisto
+Name[fy]=Yndeks
+Name[ga]=Innéacs
+Name[gl]=Índice
+Name[he]=אינדקס
+Name[hi]=सूची
+Name[hr]=Indeks
+Name[hu]=Keresési index
+Name[id]=Indeks
+Name[is]=Yfirlit
+Name[it]=Indice
+Name[ja]=インデックス
+Name[ka]=ინდექსი
+Name[kk]=Индекс
+Name[km]=លិបិក្រម
+Name[ko]=찾아보기
+Name[lo]=ດັດສະນີ
+Name[lt]=Rodyklė
+Name[lv]=Indekss
+Name[mk]=Индекс
+Name[mn]=Товчоон
+Name[ms]=Indeks
+Name[mt]=Indiċi
+Name[nb]=Indeks
+Name[ne]=अनुक्रमणिका
+Name[nn]=Indeks
+Name[nso]=Palo ya Bangwadi
+Name[pa]=ਤਤਕਰਾ
+Name[pl]=Indeks
+Name[pt]=Índice
+Name[pt_BR]=Índice
+Name[ru]=Индекс
+Name[rw]=Umubarendanga
+Name[se]=Indeaksa
+Name[sk]=Katalóg
+Name[sl]=Indeks
+Name[sr]=Индекс
+Name[sr@Latn]=Indeks
+Name[ss]=Indzikimba
+Name[ta]=பொருளடக்கம்
+Name[te]=సూచిక
+Name[tg]=Феҳрист
+Name[th]=ดัชนี
+Name[tr]=İndeks
+Name[tt]=İsemlek
+Name[uk]=Індекс
+Name[uz]=Indeks
+Name[uz@cyrillic]=Индекс
+Name[ven]=Mafhelelo a bugu
+Name[vi]=Danh mục
+Name[wa]=Indecse
+Name[xh]=Isalathiso
+Name[zh_CN]=索引
+Name[zh_TW]=索引
+Name[zu]=Uhlelo lokuqukethwe
+
+Comment=Index generation
+Comment[af]=Indeks genereering
+Comment[ar]=توليد الفهارس
+Comment[az]=İndeks yaratma
+Comment[be]=Стварэнне індэксу
+Comment[bg]=Създаване на индекс
+Comment[bn]=সূচি উত্‍পাদন
+Comment[br]=Genel ar meneger
+Comment[bs]=Pravljenje indeksa
+Comment[ca]=Generació de l'índex
+Comment[cs]=Vytvoření rejstříku
+Comment[csb]=Generowanié indeksu
+Comment[cy]=Cynhyrchu mynegai
+Comment[da]=Indeksgenerering
+Comment[de]=Erstellung des Stichwortverzeichnisses
+Comment[el]=Δημιουργία περιεχομένων
+Comment[eo]=Indekskreado
+Comment[es]=Generación del índice
+Comment[et]=Indeksi tekitamine
+Comment[eu]=Indizea sortu
+Comment[fa]=تولید نمایه
+Comment[fi]=Hakemiston luonti
+Comment[fr]=Génération d'index
+Comment[fy]=Yndeksgeneraasje
+Comment[gl]=Xeración de Índices
+Comment[he]=יצירת אינדקס
+Comment[hi]=सूची बनाएँ
+Comment[hr]=Generiranje indeksa
+Comment[hu]=Index létrehozása
+Comment[id]=Pembuatan Index
+Comment[is]=Yfirlitsgerð
+Comment[it]=Generazione dell'indice
+Comment[ja]=インデックスを生成
+Comment[ka]=ინდექსის შექმნა
+Comment[kk]=Индексті құру
+Comment[km]=ការ​បង្កើត​លិបិក្រម
+Comment[ko]=찾아보기 생성
+Comment[lo]=ສ້າງດັດສະນີ
+Comment[lt]=Rodyklės generavimas
+Comment[lv]=Indeksa ģenerēšana
+Comment[mk]=Генерирање на индекс
+Comment[mn]=Товчоон үүсгэх
+Comment[ms]=Penjanaan indeks
+Comment[mt]=Ġenerazzjoni tal-Indiċi
+Comment[nb]=Indekslaging
+Comment[nds]=Index maken
+Comment[ne]=अनुक्रमणिका उत्पादन
+Comment[nl]=Indexgeneratie
+Comment[nn]=Indekslaging
+Comment[nso]=Thlagiso ya Palo ya Bangwadi
+Comment[oc]=Generacion de l'index
+Comment[pa]=ਤਤਕਰਾ ਬਣਾਓ
+Comment[pl]=Generowanie indeksu
+Comment[pt]=Geração de índices
+Comment[pt_BR]=Geração de índice
+Comment[ro]=Generează indexul
+Comment[ru]=Создание индекса
+Comment[rw]=Irema ry'Umubarendanga
+Comment[se]=Indeaksaráhkadeapmi
+Comment[sk]=Generovanie katalógu
+Comment[sl]=Ustvarjanje indeksa
+Comment[sr]=Генерисање индекса
+Comment[sr@Latn]=Generisanje indeksa
+Comment[sv]=Indexskapare
+Comment[ta]=பொருளடக்க இயக்கம்
+Comment[te]=సూచిక ను తయారుచెయుట
+Comment[tg]=Эҷоди феҳрист
+Comment[th]=สร้างดัชนี
+Comment[tr]=İndeks oluşturma
+Comment[tt]=İsemlek ürçetü
+Comment[uk]=Утворення індексу
+Comment[uz]=Indeksni yaratish
+Comment[uz@cyrillic]=Индексни яратиш
+Comment[ven]=Murafho wa Index
+Comment[vi]=Tạo danh mục
+Comment[wa]=Ahiver l' indecse
+Comment[xh]=Ulwenziwo Lwesalathiso
+Comment[zh_CN]=索引生成
+Comment[zh_TW]=產生索引
+Comment[zu]=Ukugaywa kohlelo lokuqukethwe
+
+Keywords=Help,HTML,Search,Index,htdig,htsearch,htmerge,Scope,Language
+Keywords[ar]=مساعدة,HTML,بحث,فهرس,htdig,htsearch,htmerge,Scope,اللغة
+Keywords[az]=Yardım,HTML,Axtar,İndeks,htdig,htmerge,Dil
+Keywords[be]=Дапамога,Даведка,Пошук,Індэкс,Мова,Help,HTML,Search,Index,htdig,htsearch,htmerge,Scope,Language
+Keywords[bg]=помощ, индекс, търсене, обхват, език, Help, HTML, Search, Index, htdig, htsearch, htmerge, Scope, Language
+Keywords[ca]=Ajuda,HTML,Cerca,Índex,htdig,htsearch,htmerge,Scope,Llengua
+Keywords[cs]=Nápověda,HTML,Hledat,Index,htdig,htsearch,htmerge,Rejstřík,Jazyk,Rozsah
+Keywords[csb]=pòmòc,HTML,szëkôj,szëkba,indeks,htdig,htsearch,htmerge,òbjim,jãzëk
+Keywords[cy]=Cymorth,HTML,Chwilio,Mynegai,htdig,htsearch,htmerge,Amrediad,Iaith
+Keywords[da]=Hjælp,HTML,Søg,Indeks,htdig,htsearch,htmerge,Scope,Sprog
+Keywords[de]=Hilfe,HTML,Suche,Index,Stichwortverzeichnis,htdig,Sprachen
+Keywords[el]=Βοήθεια,HTML,Αναζήτηση,Ευρετήριο,htdig,htsearch,htmerge,Scope,Γλώσσα
+Keywords[eo]=helpo,HTML,serĉo,indekso,htdig,htsearch,htmerge,areo,lingvo
+Keywords[es]=Ayuda,HTML,Búsqueda,Índice,htdig,htsearch,htmerge,Ámbito,Idioma
+Keywords[et]=abi,HTML,otsing,indeks,htdig,htsearch,htmerge,skoop,keel
+Keywords[eu]=Laguntza,HTML,Bilatu,Indizea,htdig,htsearch,htmerge,Scope,Hizkuntza
+Keywords[fa]=کمک، زنگام، جستجو، نمایه، htdig، htsearch، htmerge، دامنه، زبان
+Keywords[fi]=Ohje,HTML,Etsi,Indeksi,htdig,htsearch,htmerge,Kieli
+Keywords[fr]=aide,HTML,recherche,index,htdig,htsearch,htmerge,pays,langue
+Keywords[fy]=help,html,zoeken,sykje,yndeks,htdig,htsearch,htmerge,scope,taal
+Keywords[ga]=Cabhair,HTML,Cuardach,Innéacs,htdig,htsearch,htmerge,Scóip,Teanga
+Keywords[gl]=Axuda,HTML,Procura,Índice,htdig,htsearch,htmerge,Scope,Lingua
+Keywords[he]=עזרה,HTML,חיפוש,אינדקס,htdig,htsearch,htmerge,טווח,שפה,Help,Search,Index,htdig,htsearch,htmerge,Scope,Language
+Keywords[hi]=मदद,एचटीएमएल,खोज,तालिका,एचटीडिक,एचटीसर्च,एचटीमर्ज,स्कोप,भाषा
+Keywords[hr]=Help,HTML,Search,Index,htdig,htsearch,htmerge,Scope,Language,Pomoć,Pretraživanje,Traži,Pretraga,Indeks,Opseg,Raspon,Jezik
+Keywords[hu]=segítség,HTML,keresés,index,htdig,htsearch,htmerge,érvényességi kör,nyelv
+Keywords[id]=Bantuan,HTML,Cari,Indeks,htdig,htsearch,htmerge,Scope,Language
+Keywords[is]=Hjálp,HTML,leit,yfirlit,htdig,svæði,tungumál
+Keywords[it]=aiuto,HTML,cerca,indice,htdig,htsearch,htmerge,scope,lingua
+Keywords[ja]=ヘルプ,HTML,検索,インデックス,htdig,htsearch,htmerge,スコープ,言語
+Keywords[km]=ជំនួយ,HTML,ស្វែងរក,លិបិក្រម,htdig,htsearch,htmerge,វិសាលភាព,ភាសា
+Keywords[lo]=ຊ່ວຍເຫລືອ,HTML,ຄົ້ນຫາດັດສະນີ,htdig,htsearch,htmerge,Scope,ພາສາ
+Keywords[lt]=Pagalba,HTML,Paieška,Sąrašas,htdig,htsearch,htmerge,Sritis,Kalba
+Keywords[lv]=Palīdzība,HTML,Meklēt,Indekss,htdig,htsearch,htmerge,Mērķis,Valoda
+Keywords[mk]=Help,HTML,Search,Index,htdig,htsearch,htmerge,Scope,Language, Помош,Пребарувај,Индекс,Опфат,Јазик
+Keywords[mn]=Тусламж,HTML,Хайх,Товчоо,Товчоон,htdig,Хэлүүд
+Keywords[mt]=Help,HTML,Search,Index,htdig,htsearch,htmerge,Scope,Language,Għajnuna,Fittex,Indiċi
+Keywords[nb]=Hjelp,HTML,Søk,Indeks,htdig,htsearch,htmerge,språk
+Keywords[nds]=Hülp,HTML,Söken,Index,htdig,htsearch,htmerge,Scope,Spraak
+Keywords[ne]=मद्दत,HTML, खोजी, अनुक्रमणिका,htdig,htsearch,htmerge, क्षेत्र, भाषा
+Keywords[nl]=help,html,zoeken,index,htdig,htsearch,htmerge,scope,taal
+Keywords[nn]=hjelp,HTML,søk,indeks,htdig,htmerge,område,språk
+Keywords[nso]=Thuso,HTML,Nyako,Palo ya Bangwadi,htdig,htnyako,htmerge,Scope,Leleme
+Keywords[pa]=ਸਹਾਇਤਾ,HTML,Index,htdig,htsearch,htmerge,Scope,ਭਾਸ਼ਾ,ਖੋਜ
+Keywords[pl]=pomoc,HTML,szukaj,indeks,htdig,htsearch,htmerge,zakres,język
+Keywords[pt]=ajuda,html,procura,índice,htdig,htsearch,htmerge,âmbito,língua
+Keywords[pt_BR]=Ajuda,HTML,Procurar,Índice,htdig,htsearch,htmerge,escopo,idioma
+Keywords[ro]=ajutor,HTML,căutare,index,htdig,htsearch,htmerge,domeniu,limbaj
+Keywords[rw]=Ifashayobora,HTML,Ishakisha,htgucukura,htgushakisha,htgukomatanya,Igishushanyombonera,Ururimi
+Keywords[se]=veahkki,HTML,ohcan,indeaksa,indeksa,htdig,htmerge,gaska,giella
+Keywords[sk]=Pomoc,HTML,Hľadať,Katalóg,Index,htdig,htsearch,htmerge,rozsah,jazyk,Pomocník
+Keywords[sl]=Pomoč,HTML,iskanje,indeks,htdig,htsearch,htmerge,doseg,jezik
+Keywords[sr]=Help,HTML,Search,Index,htdig,htsearch,htmerge,Scope,Language,помоћ,претрага,индекс,језик,опсег
+Keywords[sr@Latn]=Help,HTML,Search,Index,htdig,htsearch,htmerge,Scope,Language,pomoć,pretraga,indeks,jezik,opseg
+Keywords[sv]=Hjälp,HTML,Sök,Index,htdig,htsearch,htmerge,Omfång,Språk
+Keywords[ta]=உதவி,HTML,தேடு,பொருளடக்கம்,htdig,htதேடு,htகல,வரையெல்லை,மொழி
+Keywords[te]=సహాయం,హెచ్ టి ఎంఎల్,అన్వెషణ, సూచిక, హెచ్ టి డిగ్,హెచ్ టి అన్వెషణ,హెచ్ టి కలుపు, లక్ష్యము, భాష.
+Keywords[th]=ช่วยเหลือ,HTML,ค้นหา,ดัชนี,htdig,htsearch,htmerge,Scope,ภาษา
+Keywords[tr]=Yardım,HTML,Ara,İndeks,htdig,htmerge,Dil
+Keywords[uk]=довідка,HTML,пошук,індекс,htdig,контекст,мова,htsearch,htmerge
+Keywords[uz]=Yordam,HTML,Qidirish,Indeks,htdig,htsearch,htmerge,Til
+Keywords[uz@cyrillic]=Ёрдам,HTML,Қидириш,Индекс,htdig,htsearch,htmerge,Тил
+Keywords[ven]=Thuso,HTML,Toda,Mafhelelo,bwa ha ht,toda ha ht,thanganyo ya ht,zwaphanda,luambo
+Keywords[vi]=Trợ giúp,HTML,Tìm kiếm,danh sách,htdig,htsearch,htmerge,Phạm vi,Ngôn ngữ
+Keywords[wa]=Aide,Aidance,HTML,Trover,Indecse,htdig,htsearch,htmerge,Scope,Lingaedje
+Keywords[xh]=Uncedo,HTML,Phendla,Isalathiso,htdig,htsearch,htmerge,Scope,Ulwimi
+Keywords[zh_CN]=Help,HTML,Search,Index,htdig,htsearch,htmerge,Scope,Language,帮助,查找,索引,范围,语言
+Keywords[zh_TW]=Help,HTML,Search,Index,htdig,htsearch,htmerge,Scope,Language,求助,搜尋,索引,語言
+Keywords[zu]=Usizo,HTML,Usesho,Uhlelo lokuqukethwe,htdig,htsearch,htmerge, Indawo elinganiselwe,Ulimi
+Categories=Qt;KDE;X-KDE-settings-system;
diff --git a/khelpcenter/htmlsearch/htmlsearch.h b/khelpcenter/htmlsearch/htmlsearch.h
new file mode 100644
index 000000000..f5568218c
--- /dev/null
+++ b/khelpcenter/htmlsearch/htmlsearch.h
@@ -0,0 +1,64 @@
+#ifndef __HTMLSEARCH_H__
+#define __HTMLSEARCH_H__
+
+
+#include <qstring.h>
+#include <qstringlist.h>
+
+
+class QWidget;
+class QProgressDialog;
+
+
+class KProcess;
+
+
+class ProgressDialog;
+
+
+class HTMLSearch : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ HTMLSearch();
+
+ bool generateIndex(QString lang, QWidget *parent=0);
+
+ QString search(QString lang, QString words, QString method="and", int matches=10,
+ QString format="builtin-long", QString sort="score");
+
+
+protected slots:
+
+ void htdigStdout(KProcess *proc, char *buffer, int buflen);
+ void htdigExited(KProcess *proc);
+ void htmergeExited(KProcess *proc);
+ void htsearchStdout(KProcess *proc, char *buffer, int buflen);
+ void htsearchExited(KProcess *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;
+ KProcess *_proc;
+ int _filesToDig, _filesDigged, _filesScanned;
+ volatile bool _htdigRunning, _htmergeRunning, _htsearchRunning;
+ QString _searchResult;
+ ProgressDialog *progress;
+
+};
+
+
+#endif
diff --git a/khelpcenter/htmlsearch/index.cpp b/khelpcenter/htmlsearch/index.cpp
new file mode 100644
index 000000000..545145589
--- /dev/null
+++ b/khelpcenter/htmlsearch/index.cpp
@@ -0,0 +1,31 @@
+
+#include <kcmdlineargs.h>
+#include <kaboutdata.h>
+#include <kglobal.h>
+#include <kapplication.h>
+
+#include "htmlsearch.h"
+
+static KCmdLineOptions options[] =
+{
+ { "lang <lang>", I18N_NOOP("The language to index"), "en" },
+ KCmdLineLastOption // End of options.
+};
+
+
+int main(int argc, char *argv[])
+{
+ KAboutData aboutData( "khtmlindex", I18N_NOOP("KHtmlIndex"),
+ "",
+ I18N_NOOP("KDE Index generator for help files."));
+
+ KCmdLineArgs::init(argc, argv, &aboutData);
+ KCmdLineArgs::addCmdLineOptions( options );
+
+ KGlobal::locale()->setMainCatalogue("htmlsearch");
+ KApplication app;
+ HTMLSearch search;
+
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ search.generateIndex(args->getOption("lang"));
+}
diff --git a/khelpcenter/htmlsearch/kcmhtmlsearch.cpp b/khelpcenter/htmlsearch/kcmhtmlsearch.cpp
new file mode 100644
index 000000000..20ab149b4
--- /dev/null
+++ b/khelpcenter/htmlsearch/kcmhtmlsearch.cpp
@@ -0,0 +1,370 @@
+/**
+ * kcmhtmlsearch.cpp
+ *
+ * Copyright (c) 2000 Matthias Hlzer-Klpfel <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.
+ */
+
+#include <qlayout.h>
+#include <kstandarddirs.h>
+#include <klocale.h>
+#include <kurllabel.h>
+#include <kapplication.h>
+#include <qcheckbox.h>
+#include <qwhatsthis.h>
+#include <kfiledialog.h>
+#include <kprocess.h>
+#include "klangcombo.h"
+#include <kurlrequester.h>
+#include <klineedit.h>
+
+#include "kcmhtmlsearch.moc"
+
+
+KHTMLSearchConfig::KHTMLSearchConfig(QWidget *parent, const char *name)
+ : KCModule(parent, name), indexProc(0)
+{
+ QVBoxLayout *vbox = new QVBoxLayout(this, 5);
+
+
+ QGroupBox *gb = new QGroupBox(i18n("ht://dig"), this);
+ vbox->addWidget(gb);
+
+ QGridLayout *grid = new QGridLayout(gb, 3,2, 6,6);
+
+ grid->addRowSpacing(0, gb->fontMetrics().lineSpacing());
+
+ QLabel *l = new QLabel(i18n("The fulltext search feature makes use of the "
+ "ht://dig HTML search engine. "
+ "You can get ht://dig at the"), gb);
+ l->setAlignment(QLabel::WordBreak);
+ l->setMinimumSize(l->sizeHint());
+ grid->addMultiCellWidget(l, 1, 1, 0, 1);
+ QWhatsThis::add( gb, i18n( "Information about where to get the ht://dig package." ) );
+
+ KURLLabel *url = new KURLLabel(gb);
+ url->setURL("http://www.htdig.org");
+ url->setText(i18n("ht://dig home page"));
+ url->setAlignment(QLabel::AlignHCenter);
+ grid->addMultiCellWidget(url, 2,2, 0, 1);
+ connect(url, SIGNAL(leftClickedURL(const QString&)),
+ this, SLOT(urlClicked(const QString&)));
+
+ gb = new QGroupBox(i18n("Program Locations"), this);
+
+ vbox->addWidget(gb);
+ grid = new QGridLayout(gb, 4,2, 6,6);
+ grid->addRowSpacing(0, gb->fontMetrics().lineSpacing());
+
+ htdigBin = new KURLRequester(gb);
+ l = new QLabel(htdigBin, i18n("ht&dig"), gb);
+ l->setBuddy( htdigBin );
+ grid->addWidget(l, 1,0);
+ grid->addWidget(htdigBin, 1,1);
+ connect(htdigBin->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(configChanged()));
+ QString wtstr = i18n( "Enter the path to your htdig program here, e.g. /usr/local/bin/htdig" );
+ QWhatsThis::add( htdigBin, wtstr );
+ QWhatsThis::add( l, wtstr );
+
+ htsearchBin = new KURLRequester(gb);
+ l = new QLabel(htsearchBin, i18n("ht&search"), gb);
+ l->setBuddy( htsearchBin );
+ grid->addWidget(l, 2,0);
+ grid->addWidget(htsearchBin, 2,1);
+ connect(htsearchBin->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(configChanged()));
+ wtstr = i18n( "Enter the path to your htsearch program here, e.g. /usr/local/bin/htsearch" );
+ QWhatsThis::add( htsearchBin, wtstr );
+ QWhatsThis::add( l, wtstr );
+
+ htmergeBin = new KURLRequester(gb);
+ l = new QLabel(htmergeBin, i18n("ht&merge"), gb);
+ l->setBuddy( htmergeBin );
+ grid->addWidget(l, 3,0);
+ grid->addWidget(htmergeBin, 3,1);
+ connect(htmergeBin->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(configChanged()));
+ wtstr = i18n( "Enter the path to your htmerge program here, e.g. /usr/local/bin/htmerge" );
+ QWhatsThis::add( htmergeBin, wtstr );
+ QWhatsThis::add( l, wtstr );
+
+ QHBoxLayout *hbox = new QHBoxLayout(vbox);
+
+ gb = new QGroupBox(i18n("Scope"), this);
+ hbox->addWidget(gb);
+ QWhatsThis::add( gb, i18n( "Here you can select which parts of the documentation should be included in the fulltext search index. Available options are the KDE Help pages, the installed man pages, and the installed info pages. You can select any number of these." ) );
+
+ QVBoxLayout *vvbox = new QVBoxLayout(gb, 6,2);
+ vvbox->addSpacing(gb->fontMetrics().lineSpacing());
+
+ indexKDE = new QCheckBox(i18n("&KDE help"), gb);
+ vvbox->addWidget(indexKDE);
+ connect(indexKDE, SIGNAL(clicked()), this, SLOT(configChanged()));
+
+ indexMan = new QCheckBox(i18n("&Man pages"), gb);
+ vvbox->addWidget(indexMan);
+ indexMan->setEnabled(false),
+ connect(indexMan, SIGNAL(clicked()), this, SLOT(configChanged()));
+
+ indexInfo = new QCheckBox(i18n("&Info pages"), gb);
+ vvbox->addWidget(indexInfo);
+ indexInfo->setEnabled(false);
+ connect(indexInfo, SIGNAL(clicked()), this, SLOT(configChanged()));
+
+ gb = new QGroupBox(i18n("Additional Search Paths"), this);
+ hbox->addWidget(gb);
+ QWhatsThis::add( gb, i18n( "Here you can add additional paths to search for documentation. To add a path, click on the <em>Add...</em> button and select the folder from where additional documentation should be searched. You can remove folders by clicking on the <em>Delete</em> button." ) );
+
+ grid = new QGridLayout(gb, 4,3, 6,2);
+ grid->addRowSpacing(0, gb->fontMetrics().lineSpacing());
+
+ addButton = new QPushButton(i18n("Add..."), gb);
+ grid->addWidget(addButton, 1,0);
+
+ delButton = new QPushButton(i18n("Delete"), gb);
+ grid->addWidget(delButton, 2,0);
+
+ searchPaths = new KListBox(gb);
+ grid->addMultiCellWidget(searchPaths, 1,3, 1,1);
+ grid->setRowStretch(2,2);
+
+ gb = new QGroupBox(i18n("Language Settings"), this);
+ vbox->addWidget(gb);
+ QWhatsThis::add(gb, i18n("Here you can select the language you want to create the index for."));
+ language = new KLanguageCombo(gb);
+ l = new QLabel(language, i18n("&Language"), gb);
+ vvbox = new QVBoxLayout(gb, 6,2);
+ vvbox->addSpacing(gb->fontMetrics().lineSpacing());
+ hbox = new QHBoxLayout(vvbox, 6);
+ hbox->addWidget(l);
+ hbox->addWidget(language,1);
+ hbox->addStretch(1);
+
+ loadLanguages();
+
+ vbox->addStretch(1);
+
+ runButton = new QPushButton(i18n("Generate Index..."), this);
+ QWhatsThis::add( runButton, i18n( "Click this button to generate the index for the fulltext search." ) );
+ runButton->setFixedSize(runButton->sizeHint());
+ vbox->addWidget(runButton, AlignRight);
+ connect(runButton, SIGNAL(clicked()), this, SLOT(generateIndex()));
+
+ connect(addButton, SIGNAL(clicked()), this, SLOT(addClicked()));
+ connect(delButton, SIGNAL(clicked()), this, SLOT(delClicked()));
+ connect(searchPaths, SIGNAL(highlighted(const QString &)),
+ this, SLOT(pathSelected(const QString &)));
+
+ checkButtons();
+
+ load();
+}
+
+
+void KHTMLSearchConfig::loadLanguages()
+{
+ // clear the list
+ language->clear();
+
+ // add all languages to the list
+ QStringList langs = KGlobal::dirs()->findAllResources("locale",
+ QString::fromLatin1("*/entry.desktop"));
+ langs.sort();
+
+ for (QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it)
+ {
+ KSimpleConfig entry(*it);
+ entry.setGroup(QString::fromLatin1("KCM Locale"));
+ QString name = entry.readEntry(QString::fromLatin1("Name"), KGlobal::locale()->translate("without name"));
+
+ QString path = *it;
+ int index = path.findRev('/');
+ path = path.left(index);
+ index = path.findRev('/');
+ path = path.mid(index+1);
+ language->insertLanguage(path, name);
+ }
+}
+
+
+QString KHTMLSearchConfig::quickHelp() const
+{
+ return i18n( "<h1>Help Index</h1> This configuration module lets you configure the ht://dig engine which can be used for fulltext search in the KDE documentation as well as other system documentation like man and info pages." );
+}
+
+
+void KHTMLSearchConfig::pathSelected(const QString &)
+{
+ checkButtons();
+}
+
+
+void KHTMLSearchConfig::checkButtons()
+{
+
+ delButton->setEnabled(searchPaths->currentItem() >= 0);
+}
+
+
+void KHTMLSearchConfig::addClicked()
+{
+ QString dir = KFileDialog::getExistingDirectory();
+
+ if (!dir.isEmpty())
+ {
+ for (uint i=0; i<searchPaths->count(); ++i)
+ if (searchPaths->text(i) == dir)
+ return;
+ searchPaths->insertItem(dir);
+ configChanged();
+ }
+}
+
+
+void KHTMLSearchConfig::delClicked()
+{
+ searchPaths->removeItem(searchPaths->currentItem());
+ checkButtons();
+ configChanged();
+}
+
+
+KHTMLSearchConfig::~KHTMLSearchConfig()
+{
+}
+
+
+void KHTMLSearchConfig::configChanged()
+{
+ emit changed(true);
+}
+
+
+void KHTMLSearchConfig::load()
+{
+ KConfig *config = new KConfig("khelpcenterrc", true);
+
+ config->setGroup("htdig");
+ htdigBin->lineEdit()->setText(config->readPathEntry("htdig", kapp->dirs()->findExe("htdig")));
+ htsearchBin->lineEdit()->setText(config->readPathEntry("htsearch", kapp->dirs()->findExe("htsearch")));
+ htmergeBin->lineEdit()->setText(config->readPathEntry("htmerge", kapp->dirs()->findExe("htmerge")));
+
+ config->setGroup("Scope");
+ indexKDE->setChecked(config->readBoolEntry("KDE", true));
+ indexMan->setChecked(config->readBoolEntry("Man", false));
+ indexInfo->setChecked(config->readBoolEntry("Info", false));
+
+ QStringList l = config->readPathListEntry("Paths");
+ searchPaths->clear();
+ QStringList::Iterator it;
+ for (it=l.begin(); it != l.end(); ++it)
+ searchPaths->insertItem(*it);
+
+ config->setGroup("Locale");
+ QString lang = config->readEntry("Search Language", KGlobal::locale()->language());
+ language->setCurrentItem(lang);
+
+ emit changed(false);
+}
+
+
+void KHTMLSearchConfig::save()
+{
+ KConfig *config= new KConfig("khelpcenterrc", false);
+
+ config->setGroup("htdig");
+ config->writePathEntry("htdig", htdigBin->lineEdit()->text());
+ config->writePathEntry("htsearch", htsearchBin->lineEdit()->text());
+ config->writePathEntry("htmerge", htmergeBin->lineEdit()->text());
+
+ config->setGroup("Scope");
+ config->writeEntry("KDE", indexKDE->isChecked());
+ config->writeEntry("Man", indexMan->isChecked());
+ config->writeEntry("Info", indexInfo->isChecked());
+
+ QStringList l;
+ for (uint i=0; i<searchPaths->count(); ++i)
+ l.append(searchPaths->text(i));
+ config->writePathEntry("Paths", l);
+
+ config->setGroup("Locale");
+ config->writeEntry("Search Language", language->currentTag());
+
+ config->sync();
+ delete config;
+
+ emit changed(false);
+}
+
+
+void KHTMLSearchConfig::defaults()
+{
+ htdigBin->lineEdit()->setText(kapp->dirs()->findExe("htdig"));
+ htsearchBin->lineEdit()->setText(kapp->dirs()->findExe("htsearch"));
+ htmergeBin->lineEdit()->setText(kapp->dirs()->findExe("htmerge"));
+
+ indexKDE->setChecked(true);
+ indexMan->setChecked(false);
+ indexInfo->setChecked(false);
+
+ searchPaths->clear();
+
+ language->setCurrentItem(KGlobal::locale()->language());
+
+ emit changed(true);
+}
+
+
+void KHTMLSearchConfig::urlClicked(const QString &url)
+{
+ kapp->invokeBrowser(url);
+}
+
+
+void KHTMLSearchConfig::generateIndex()
+{
+ save();
+
+ QString exe = kapp->dirs()->findExe("khtmlindex");
+ if (exe.isEmpty())
+ return;
+
+ delete indexProc;
+
+ indexProc = new KProcess;
+ *indexProc << exe << "--lang" << language->currentTag();
+
+ connect(indexProc, SIGNAL(processExited(KProcess *)),
+ this, SLOT(indexTerminated(KProcess *)));
+
+ runButton->setEnabled(false);
+
+ indexProc->start();
+}
+
+
+void KHTMLSearchConfig::indexTerminated(KProcess *)
+{
+ runButton->setEnabled(true);
+}
+
+
+extern "C"
+{
+ KDE_EXPORT KCModule *create_htmlsearch(QWidget *parent, const char *name)
+ {
+ KGlobal::locale()->insertCatalogue("kcmhtmlsearch");
+ return new KHTMLSearchConfig(parent, name);
+ };
+}
diff --git a/khelpcenter/htmlsearch/kcmhtmlsearch.h b/khelpcenter/htmlsearch/kcmhtmlsearch.h
new file mode 100644
index 000000000..630f5aeda
--- /dev/null
+++ b/khelpcenter/htmlsearch/kcmhtmlsearch.h
@@ -0,0 +1,81 @@
+/**
+ * kcmhtmlsearch.h
+ *
+ * Copyright (c) 2000 Matthias Hlzer-Klpfel <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__
+
+
+#include <kcmodule.h>
+
+
+class QLineEdit;
+class QCheckBox;
+class QPushButton;
+class KListBox;
+class KProcess;
+class KLanguageCombo;
+class KURLRequester;
+
+class KHTMLSearchConfig : public KCModule
+{
+ Q_OBJECT
+
+public:
+
+ KHTMLSearchConfig(QWidget *parent = 0L, const char *name = 0L);
+ virtual ~KHTMLSearchConfig();
+
+ void load();
+ void save();
+ void defaults();
+
+ QString quickHelp() const;
+
+ int buttons();
+
+
+protected slots:
+
+ void configChanged();
+ void addClicked();
+ void delClicked();
+ void pathSelected(const QString &);
+ void urlClicked(const QString&);
+ void generateIndex();
+
+ void indexTerminated(KProcess *proc);
+
+
+private:
+
+ void checkButtons();
+ void loadLanguages();
+
+ KURLRequester *htdigBin, *htsearchBin, *htmergeBin;
+ QCheckBox *indexKDE, *indexMan, *indexInfo;
+ QPushButton *addButton, *delButton, *runButton;
+ KListBox *searchPaths;
+ KLanguageCombo *language;
+
+ KProcess *indexProc;
+
+};
+
+#endif
diff --git a/khelpcenter/htmlsearch/klangcombo.cpp b/khelpcenter/htmlsearch/klangcombo.cpp
new file mode 100644
index 000000000..0b41ea1e9
--- /dev/null
+++ b/khelpcenter/htmlsearch/klangcombo.cpp
@@ -0,0 +1,52 @@
+/*
+ * 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 <qiconset.h>
+
+#include <kstandarddirs.h>
+
+#include "klangcombo.h"
+#include "klangcombo.moc"
+
+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 + QString::fromLatin1(" (") + path + QString::fromLatin1(")");
+ QPixmap flag(locate("locale", sub + path + QString::fromLatin1("/flag.png")));
+ insertItem(QIconSet(flag), output, path, submenu, index);
+}
+
+void KLanguageCombo::changeLanguage(const QString& name, int i)
+{
+ if (i < 0 || i >= count()) return;
+ QString output = name + QString::fromLatin1(" (") + tag(i) + QString::fromLatin1(")");
+ changeItem(output, i);
+}
diff --git a/khelpcenter/htmlsearch/klangcombo.h b/khelpcenter/htmlsearch/klangcombo.h
new file mode 100644
index 000000000..1c556ae64
--- /dev/null
+++ b/khelpcenter/htmlsearch/klangcombo.h
@@ -0,0 +1,47 @@
+/*
+ * 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 menues.
+ */
+class KLanguageCombo : public KTagComboBox
+{
+ Q_OBJECT
+
+public:
+ KLanguageCombo(QWidget *parent=0, const char *name=0);
+ ~KLanguageCombo();
+
+ void insertLanguage(const QString& path, const QString& name, const QString& sub = QString::null, const QString &submenu = QString::null, int index = -1);
+ void changeLanguage(const QString& name, int i);
+};
+
+#endif
diff --git a/khelpcenter/htmlsearch/ktagcombobox.cpp b/khelpcenter/htmlsearch/ktagcombobox.cpp
new file mode 100644
index 000000000..eea4c149f
--- /dev/null
+++ b/khelpcenter/htmlsearch/ktagcombobox.cpp
@@ -0,0 +1,252 @@
+/*
+ * 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 <qpainter.h>
+#include <qpopupmenu.h>
+
+#include <kdebug.h>
+
+#include "ktagcombobox.h"
+#include "ktagcombobox.moc"
+
+KTagComboBox::~KTagComboBox ()
+{
+ delete popup;
+ delete tags;
+}
+
+KTagComboBox::KTagComboBox (QWidget * parent, const char *name)
+ : QComboBox(parent, name),
+ popup(0),
+ old_popup(0)
+{
+ tags = new QStringList;
+
+ 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();
+}
+
+void KTagComboBox::internalActivate( int index )
+{
+ if (current == index) return;
+ current = index;
+ emit activated( index );
+ repaint();
+}
+
+void KTagComboBox::internalHighlight( int index )
+{
+ emit highlighted( index );
+}
+
+void KTagComboBox::clear()
+{
+ tags->clear();
+
+ delete old_popup;
+ old_popup = popup;
+ popup = new QPopupMenu(this);
+ connect( popup, SIGNAL(activated(int)),
+ SLOT(internalActivate(int)) );
+ connect( popup, SIGNAL(highlighted(int)),
+ SLOT(internalHighlight(int)) );
+}
+
+int KTagComboBox::count() const
+{
+ return tags->count();
+}
+
+static inline void checkInsertPos(QPopupMenu *popup, const QString & str, int &index)
+{
+ if (index == -2) index = popup->count();
+ if (index != -1) return;
+
+ int a = 0;
+ int b = popup->count();
+ while (a <= b) {
+ int w = (a + b) / 2;
+
+ int id = popup->idAt(w);
+ int j = str.compare(popup->text(id));
+
+ if (j > 0)
+ a = w + 1;
+ else
+ b = w - 1;
+ }
+
+ index = a; // it doesn't really matter ... a == b here.
+}
+
+static inline QPopupMenu *checkInsertIndex(QPopupMenu *popup, const QStringList *tags, const QString &submenu)
+{
+ int pos = tags->findIndex(submenu);
+
+ QPopupMenu *pi = 0;
+ if (pos != -1)
+ {
+ QMenuItem *p = popup->findItem(pos);
+ pi = p?p->popup():0;
+ }
+ if (!pi) pi = popup;
+
+ return pi;
+}
+
+void KTagComboBox::insertItem(const QIconSet& icon, const QString &text, const QString &tag, const QString &submenu, int index )
+{
+ QPopupMenu *pi = checkInsertIndex(popup, tags, submenu);
+ checkInsertPos(pi, text, index);
+ pi->insertItem(icon, text, count(), index);
+ tags->append(tag);
+}
+
+void KTagComboBox::insertItem(const QString &text, const QString &tag, const QString &submenu, int index )
+{
+ QPopupMenu *pi = checkInsertIndex(popup, tags, submenu);
+ checkInsertPos(pi, text, index);
+ pi->insertItem(text, count(), index);
+ tags->append(tag);
+}
+
+void KTagComboBox::insertSeparator(const QString &submenu, int index)
+{
+ QPopupMenu *pi = checkInsertIndex(popup, tags, submenu);
+ pi->insertSeparator(index);
+ tags->append(QString::null);
+}
+
+void KTagComboBox::insertSubmenu(const QString &text, const QString &tag, const QString &submenu, int index)
+{
+ QPopupMenu *pi = checkInsertIndex(popup, tags, submenu);
+ QPopupMenu *p = new QPopupMenu(pi);
+ checkInsertPos(pi, text, index);
+ pi->insertItem(text, p, count(), index);
+ tags->append(tag);
+ connect( p, SIGNAL(activated(int)),
+ SLOT(internalActivate(int)) );
+ connect( p, SIGNAL(highlighted(int)),
+ SLOT(internalHighlight(int)) );
+}
+
+void KTagComboBox::paintEvent( QPaintEvent * ev)
+{
+ QComboBox::paintEvent(ev);
+
+ QPainter p (this);
+
+ // Text
+ QRect clip(2, 2, width() - 4, height() - 4);
+#if 0
+ if ( hasFocus() && style().guiStyle() != MotifStyle )
+ p.setPen( colorGroup().highlightedText() );
+#endif
+ p.drawText(clip, AlignCenter | SingleLine, popup->text( current ));
+
+ // Icon
+ QIconSet *icon = popup->iconSet( this->current );
+ if (icon) {
+ QPixmap pm = icon->pixmap();
+ p.drawPixmap( 4, (height()-pm.height())/2, pm );
+ }
+}
+
+bool KTagComboBox::containsTag( const QString &str ) const
+{
+ return tags->contains(str) > 0;
+}
+
+QString KTagComboBox::currentTag() const
+{
+ return *tags->at(currentItem());
+}
+
+QString KTagComboBox::tag(int i) const
+{
+ if (i < 0 || i >= count())
+ {
+ kdDebug() << "KTagComboBox::tag(), unknown tag " << i << endl;
+ return QString::null;
+ }
+ return *tags->at(i);
+}
+
+int KTagComboBox::currentItem() const
+{
+ return current;
+}
+
+void KTagComboBox::setCurrentItem(int i)
+{
+ if (i < 0 || i >= count()) return;
+ current = i;
+ repaint();
+}
+
+void KTagComboBox::setCurrentItem(const QString &code)
+{
+ int i = tags->findIndex(code);
+ if (code.isNull())
+ i = 0;
+ if (i != -1)
+ setCurrentItem(i);
+}
+
+void KTagComboBox::setFont( const QFont &font )
+{
+ QComboBox::setFont( font );
+ popup->setFont( font );
+}
diff --git a/khelpcenter/htmlsearch/ktagcombobox.h b/khelpcenter/htmlsearch/ktagcombobox.h
new file mode 100644
index 000000000..28aad2dc8
--- /dev/null
+++ b/khelpcenter/htmlsearch/ktagcombobox.h
@@ -0,0 +1,92 @@
+/*
+ * ktagcombobox.h - 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.
+ */
+
+
+#ifndef __KTAGCOMBOBOX_H__
+#define __KTAGCOMBOBOX_H__
+
+#include <qcombobox.h>
+
+class QPopupMenu;
+
+/*
+ * This class should be just like qcombobox, but it should be possible
+ * to have have a QIconSet for each entry, and each entry should have a tag.
+ *
+ * It has also support for sub menues.
+ */
+class KTagComboBox : public QComboBox
+{
+ Q_OBJECT
+
+public:
+ KTagComboBox(QWidget *parent=0, const char *name=0);
+ ~KTagComboBox();
+
+ void insertItem(const QIconSet& icon, const QString &text, const QString &tag, const QString &submenu = QString::null, int index=-1 );
+ void insertItem(const QString &text, const QString &tag, const QString &submenu = QString::null, int index=-1 );
+ void insertSeparator(const QString &submenu = QString::null, int index=-1 );
+ void insertSubmenu(const QString &text, const QString &tag, const QString &submenu = QString::null, int index=-1);
+
+ int count() const;
+ void clear();
+
+ /*
+ * Tag of the selected item
+ */
+ QString currentTag() const;
+ QString tag ( int i ) const;
+ bool containsTag (const QString &str ) const;
+
+ /*
+ * Set the current item
+ */
+ int currentItem() const;
+ void setCurrentItem(int i);
+ void setCurrentItem(const QString &code);
+
+ // widget stuff
+ virtual void setFont( const QFont & );
+
+signals:
+ void activated( int index );
+ void highlighted( int index );
+
+private slots:
+ void internalActivate( int );
+ void internalHighlight( int );
+
+protected:
+ void paintEvent( QPaintEvent * );
+ void mousePressEvent( QMouseEvent * );
+ void keyPressEvent( QKeyEvent *e );
+ void popupMenu();
+
+private:
+ // work space for the new class
+ QStringList *tags;
+ QPopupMenu *popup, *old_popup;
+ int current;
+};
+
+#endif
diff --git a/khelpcenter/htmlsearch/long.html b/khelpcenter/htmlsearch/long.html
new file mode 100644
index 000000000..1d0fa4cec
--- /dev/null
+++ b/khelpcenter/htmlsearch/long.html
@@ -0,0 +1,6 @@
+<dl><dt><strong><a href="$&(URL)">$&(TITLE)</a></strong>$(STARSLEFT)
+</dt><dd>$(EXCERPT)<br>
+<i><a href="$&(URL)">$&(URL)</a></i>
+<font size="-1">$(MODIFIED), $(SIZE) bytes</font>
+</dd></dl>
+
diff --git a/khelpcenter/htmlsearch/meinproc_wrapper b/khelpcenter/htmlsearch/meinproc_wrapper
new file mode 100644
index 000000000..239cf7462
--- /dev/null
+++ b/khelpcenter/htmlsearch/meinproc_wrapper
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+file=`echo $3 | sed -e "s#http://localhost/#/#; s#file:/*#/#"`
+meinproc --htdig $file
diff --git a/khelpcenter/htmlsearch/nomatch.html b/khelpcenter/htmlsearch/nomatch.html
new file mode 100644
index 000000000..305927030
--- /dev/null
+++ b/khelpcenter/htmlsearch/nomatch.html
@@ -0,0 +1,21 @@
+<html><head><title>No match for '$&(LOGICAL_WORDS)'</title></head>
+<body bgcolor="#ffffff" text="#000000" link="#aa0000">
+<h1><img src="htdig.gif">
+Search results</h1>
+<hr noshade size="4">
+<h2>No matches were found for '$&(LOGICAL_WORDS)'</h2>
+<p>
+Check the spelling of the search word(s) you used.
+If the spelling is correct and you only used one word,
+try using one or more similar search words with "<b>Any</b>."
+</p><p>
+If the spelling is correct and you used more than one
+word with "<b>Any</b>," try using one or more similar search
+words with "<b>Any</b>."</p><p>
+If the spelling is correct and you used more than one
+word with "<b>All</b>," try using one or more of the same words
+with "<b>Any</b>."</p>
+<hr noshade size="4">
+<a href="http://www.htdig.org/">
+<img src="htdig.gif" border="0">ht://Dig $(VERSION)</a>
+</body></html>
diff --git a/khelpcenter/htmlsearch/progressdialog.cpp b/khelpcenter/htmlsearch/progressdialog.cpp
new file mode 100644
index 000000000..497c90324
--- /dev/null
+++ b/khelpcenter/htmlsearch/progressdialog.cpp
@@ -0,0 +1,76 @@
+#include <qlayout.h>
+#include <qlabel.h>
+
+
+#include <klocale.h>
+#include <kprogress.h>
+#include <kstandarddirs.h>
+
+
+#include "progressdialog.moc"
+
+
+ProgressDialog::ProgressDialog(QWidget *parent, const char *name)
+ : KDialogBase(KDialogBase::Plain, i18n("Generating Index"), Cancel, Cancel,
+ parent, name, false)
+{
+ QGridLayout *grid = new QGridLayout(plainPage(), 5,3, spacingHint());
+
+ QLabel *l = new QLabel(i18n("Scanning for files"), plainPage());
+ grid->addMultiCellWidget(l, 0,0, 1,2);
+
+ filesScanned = new QLabel(plainPage());
+ grid->addWidget(filesScanned, 1,2);
+ setFilesScanned(0);
+
+ check1 = new QLabel(plainPage());
+ grid->addWidget(check1, 0,0);
+
+ l = new QLabel(i18n("Extracting search terms"), plainPage());
+ grid->addMultiCellWidget(l, 2,2, 1,2);
+
+ bar = new KProgress(plainPage());
+ grid->addWidget(bar, 3,2);
+
+ check2 = new QLabel(plainPage());
+ grid->addWidget(check2, 2,0);
+
+ l = new QLabel(i18n("Generating index..."), plainPage());
+ grid->addMultiCellWidget(l, 4,4, 1,2);
+
+ check3 = new QLabel(plainPage());
+ grid->addWidget(check3, 4,0);
+
+ setState(0);
+
+ setMinimumWidth(300);
+}
+
+
+void ProgressDialog::setFilesScanned(int n)
+{
+ filesScanned->setText(i18n("Files processed: %1").arg(n));
+}
+
+
+void ProgressDialog::setFilesToDig(int n)
+{
+ bar->setTotalSteps(n);
+}
+
+
+void ProgressDialog::setFilesDigged(int n)
+{
+ bar->setProgress(n);
+}
+
+
+void ProgressDialog::setState(int n)
+{
+ QPixmap unchecked = QPixmap(locate("data", "khelpcenter/pics/unchecked.xpm"));
+ QPixmap checked = QPixmap(locate("data", "khelpcenter/pics/checked.xpm"));
+
+ check1->setPixmap( n > 0 ? checked : unchecked);
+ check2->setPixmap( n > 1 ? checked : unchecked);
+ check3->setPixmap( n > 2 ? checked : unchecked);
+}
diff --git a/khelpcenter/htmlsearch/progressdialog.h b/khelpcenter/htmlsearch/progressdialog.h
new file mode 100644
index 000000000..9c18f2d01
--- /dev/null
+++ b/khelpcenter/htmlsearch/progressdialog.h
@@ -0,0 +1,35 @@
+#ifndef __PROGRESS_DIALOG_H__
+#define __PROGRESS_DIALOG_H__
+
+
+#include <kdialogbase.h>
+
+
+class QLabel;
+class KProgress;
+
+
+class ProgressDialog : public KDialogBase
+{
+
+ Q_OBJECT
+
+public:
+
+ ProgressDialog(QWidget *parent=0, const char *name=0);
+
+ void setFilesScanned(int s);
+ void setFilesToDig(int d);
+ void setFilesDigged(int d);
+
+ void setState(int n);
+
+private:
+
+ QLabel *filesScanned, *check1, *check2, *check3;
+ KProgress *bar;
+
+};
+
+
+#endif
diff --git a/khelpcenter/htmlsearch/short.html b/khelpcenter/htmlsearch/short.html
new file mode 100644
index 000000000..e3e5e447f
--- /dev/null
+++ b/khelpcenter/htmlsearch/short.html
@@ -0,0 +1 @@
+$(STARSRIGHT) <strong><a href="$&(URL)">$&(TITLE)</a></strong><br>
diff --git a/khelpcenter/htmlsearch/star.png b/khelpcenter/htmlsearch/star.png
new file mode 100644
index 000000000..5e7615871
--- /dev/null
+++ b/khelpcenter/htmlsearch/star.png
Binary files differ
diff --git a/khelpcenter/htmlsearch/star_blank.png b/khelpcenter/htmlsearch/star_blank.png
new file mode 100644
index 000000000..2689281af
--- /dev/null
+++ b/khelpcenter/htmlsearch/star_blank.png
Binary files differ
diff --git a/khelpcenter/htmlsearch/syntax.html b/khelpcenter/htmlsearch/syntax.html
new file mode 100644
index 000000000..e724fd90c
--- /dev/null
+++ b/khelpcenter/htmlsearch/syntax.html
@@ -0,0 +1,19 @@
+<html><head><title>Error in Boolean search for '$&(WORDS)'</title></head>
+<body bgcolor="#ffffff" text="#000000" link="#aa0000">
+<h1><img src="htdig.gif">
+Error in Boolean search for '$&(LOGICAL_WORDS)'</h1>
+<hr noshade size="4">
+Boolean expressions need to be 'correct' in order for the search
+system to use them.
+The expression you entered has errors in it.<p>
+Examples of correct expressions are: <b>cat and dog</b>, <b>cat
+not dog</b>, <b>cat or (dog not nose)</b>.<br>Note that
+the operator <b>not</b> has the meaning of 'without'.
+<blockquote><b>
+$(SYNTAXERROR)
+</b></blockquote>
+<hr noshade size="4">
+<a href="http://www.htdig.org/">
+<img src="htdig.gif" border="0">ht://Dig $(VERSION)</a>
+</body></html>
+
diff --git a/khelpcenter/htmlsearch/unchecked.xpm b/khelpcenter/htmlsearch/unchecked.xpm
new file mode 100644
index 000000000..e447281a9
--- /dev/null
+++ b/khelpcenter/htmlsearch/unchecked.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static char*unchecked[]={
+"16 16 3 1",
+"# c #000000",
+"+ c #ffffff",
+". c None",
+"................",
+"................",
+"..++++++++++++..",
+"..+##########+..",
+"..+#++++++++#+..",
+"..+#+......+#+..",
+"..+#+......+#+..",
+"..+#+......+#+..",
+"..+#+......+#+..",
+"..+#+......+#+..",
+"..+#+......+#+..",
+"..+#++++++++#+..",
+"..+##########+..",
+"..++++++++++++..",
+"................",
+"................"};
diff --git a/khelpcenter/htmlsearch/wrapper.html b/khelpcenter/htmlsearch/wrapper.html
new file mode 100644
index 000000000..251266ded
--- /dev/null
+++ b/khelpcenter/htmlsearch/wrapper.html
@@ -0,0 +1,16 @@
+<html><head><title>Search results for '$&(WORDS)'</title></head>
+<body bgcolor="#ffffff" text="#000000" link="#aa0000">
+<h2><img src="htdig.gif">
+Search results for '$&(LOGICAL_WORDS)'</h2>
+<hr noshade size="4">
+<b>
+More <img src="reload.png" alt="*">'s indicate a better match.
+</b>
+<hr noshade size="1">
+$(HTSEARCH_RESULTS)
+$(PAGEHEADER)
+$(PREVPAGE) $(PAGELIST) $(NEXTPAGE)
+<hr noshade size="4">
+<a href="http://www.htdig.org/">
+<img src="htdig.gif" border="0">ht://Dig $(VERSION)</a>
+</body></html>