From f16b630348b5b14c0a3c481be606185f31b6ef12 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 9 Feb 2020 19:43:10 +0900 Subject: Removed beagle related code. Signed-off-by: Michele Calgaro --- khelpcenter/searchhandlers/CMakeLists.txt | 2 +- khelpcenter/searchhandlers/Makefile.am | 2 +- khelpcenter/searchhandlers/khc_beagle_index.pl | 49 -------------- khelpcenter/searchhandlers/khc_beagle_search.pl | 88 ------------------------- 4 files changed, 2 insertions(+), 139 deletions(-) delete mode 100644 khelpcenter/searchhandlers/khc_beagle_index.pl delete mode 100644 khelpcenter/searchhandlers/khc_beagle_search.pl (limited to 'khelpcenter/searchhandlers') diff --git a/khelpcenter/searchhandlers/CMakeLists.txt b/khelpcenter/searchhandlers/CMakeLists.txt index 3d18a8008..6c91e7a9c 100644 --- a/khelpcenter/searchhandlers/CMakeLists.txt +++ b/khelpcenter/searchhandlers/CMakeLists.txt @@ -37,7 +37,7 @@ install( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/khc_htdig.pl ${CMAKE_CURRENT_BINARY_DIR}/khc_htsearch.pl ${CMAKE_CURRENT_BINARY_DIR}/khc_docbookdig.pl - khc_beagle_search.pl khc_mansearch.pl khc_beagle_index.pl + khc_mansearch.pl DESTINATION ${BIN_INSTALL_DIR} ) install( FILES diff --git a/khelpcenter/searchhandlers/Makefile.am b/khelpcenter/searchhandlers/Makefile.am index f2ebd57ff..65f4060b6 100644 --- a/khelpcenter/searchhandlers/Makefile.am +++ b/khelpcenter/searchhandlers/Makefile.am @@ -3,7 +3,7 @@ searchhandlers_DATA = htdig.desktop man.desktop docbook.desktop searchhandlersdir = $(kde_datadir)/khelpcenter/searchhandlers kde_bin_SCRIPTS = khc_htdig.pl khc_htsearch.pl khc_mansearch.pl \ - khc_docbookdig.pl khc_beagle_search.pl khc_beagle_index.pl + khc_docbookdig.pl htdigdata_DATA = htdig_long.html diff --git a/khelpcenter/searchhandlers/khc_beagle_index.pl b/khelpcenter/searchhandlers/khc_beagle_index.pl deleted file mode 100644 index aaec63607..000000000 --- a/khelpcenter/searchhandlers/khc_beagle_index.pl +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/perl -# vim:sw=4:et - -use warnings; - -sub getKDEDocDir() -{ - my $prefix = `tde-config --prefix`; - chomp $prefix; - - $prefix = "/opt/kde" if (not defined($prefix)); - return "$prefix/share/doc"; -} - -sub addRoot() -{ - my $kdedocdir = &getKDEDocDir; - - open (IN, "-|") || exec "beagle-config", "indexing", "ListRoots"; - - my $kdedoc_found = 0; - while() { - if (/^$kdedocdir/o) { - $kdedoc_found = 1; - last; - } - } - close(IN); - - if (not $kdedoc_found) { - `beagle-config indexing AddRoot $kdedocdir`; - `beagle-config indexing AddRoot $kdedocdir-bundle`; - } -} - -sub createExistsFile($$) -{ - my ($idir, $ident) = @_; - - open(OUT, ">", "$idir/$idir"); - close(OUT); -} - -my $idir = $ARGV[0]; -my $ident = $ARGV[1]; - -if (addRoot) { - createExistsFile($idir, $ident); -} diff --git a/khelpcenter/searchhandlers/khc_beagle_search.pl b/khelpcenter/searchhandlers/khc_beagle_search.pl deleted file mode 100644 index d7a1f44b8..000000000 --- a/khelpcenter/searchhandlers/khc_beagle_search.pl +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/perl -w -# vim:sw=4:et - -use warnings; -use strict; -use Getopt::Long; - -sub isBeagleRunning() -{ - open(IN, "-|") || exec "beagle-ping"; - while() { - if (/^Daemon version:/) { - close(IN); - return 1; - } - } - close(IN); - return 0; -} - -sub formatHTML($$) -{ - my ($query, $hits) = @_; - - print "\n\n"; - - foreach my $hit(@$hits) { - print "
  • $hit
  • \n"; - } - print "\n\n\n"; -} - -sub beagleQuery($$$) -{ - my ($words, $method, $maxnum) = @_; - - my @hits = (); - - open(IN, "-|") || exec "beagle-query", "--type", "DocbookEntry", "--type", "File", "--max-hits", $maxnum, @$words, "ext:docbook"; - while() { - chop; - next if (/^Debug:/); - - my $uri = $_; - $uri = $1 if ($uri =~ /^file:\/\/(.*)$/); - - print "uri: $uri\n"; - my $helpLink = &makeHelpLink($uri); - - push(@hits, $helpLink) if (!grep { /^$helpLink$/ } @hits); - } - close(IN); - return @hits; -} - -sub makeHelpLink($) -{ - # Try to figure out the name of the application from the path to its index.docbook file - - my ($path) = @_; - my @pathcomponents = split '/', $path; - - my $appName = $pathcomponents[-2]; - my $appName2 = $pathcomponents[-3]; - - if ($appName eq $appName2 or $appName2 eq "doc" - or (-d "/usr/share/locale/$appName2")) { - return "$appName"; - } - return "$appName ($appName2)"; -} - -my $method = "and"; -my $maxnum = 100; - -GetOptions("method=s", \$method, "maxnum=i", \$maxnum); - -my @hits = ("The Beagle daemon is not running, search is not available"); - -my @words = @ARGV; - -if (isBeagleRunning()) { - @hits = beagleQuery(\@words, $method, $maxnum); -} - -@hits = ("There are no search results") if ($#hits < 0); - -formatHTML(\@words, \@hits); -- cgit v1.2.1