From 546508a382cc46354a9af3684a5f926595e81be6 Mon Sep 17 00:00:00 2001
From: dockes
Date: Mon, 17 Nov 2008 14:51:38 +0000
Subject: [PATCH] 1st kde test. cmake doesnt work need to use buildit script
---
src/kde/kioslave/recoll/CMakeLists.txt | 46 ++++
src/kde/kioslave/recoll/Makefile | 316 ++++++++++++++++++++-----
src/kde/kioslave/recoll/Makefile.kde3 | 59 +++++
src/kde/kioslave/recoll/kio_recoll.cpp | 90 ++++---
src/kde/kioslave/recoll/kio_recoll.h | 18 +-
5 files changed, 438 insertions(+), 91 deletions(-)
create mode 100644 src/kde/kioslave/recoll/CMakeLists.txt
create mode 100644 src/kde/kioslave/recoll/Makefile.kde3
diff --git a/src/kde/kioslave/recoll/CMakeLists.txt b/src/kde/kioslave/recoll/CMakeLists.txt
new file mode 100644
index 00000000..07a50677
--- /dev/null
+++ b/src/kde/kioslave/recoll/CMakeLists.txt
@@ -0,0 +1,46 @@
+project(kio_recoll)
+set(VERSION_MAJOR "1")
+set(VERSION_MINOR "11")
+set(VERSION_PATCH "0")
+set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules )
+
+include(InstallRequiredSystemLibraries)
+
+#set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Recoll KIO Slave")
+#set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
+#set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
+#set(CPACK_PACKAGE_VERSION "${VERSION}")
+#set(CPACK_GENERATOR TGZ)
+#set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION}" CACHE INTERNAL "
+#tarball basename")
+#SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${CPACK_PACKAGE_VERSION}")
+#include(CPack)
+
+# search packages used by KDE
+find_package(KDE4 REQUIRED)
+include (UsePkgConfig)
+include (KDE4Defaults)
+include (MacroLibrary)
+include(MacroOptionalAddSubdirectory)
+
+add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
+
+set(depth ../../../)
+
+include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES}
+${depth}/utils ${depth}/rcldb ${depth}/query ${depth}/unac
+${depth}/common ${depth}/internfile ${depth}/index ${depth}/bincimapmime
+)
+
+set(kio_recoll_SRCS
+ kio_recoll.cpp
+)
+
+kde4_add_plugin(kio_recoll ${kio_recoll_SRCS})
+link_directories(/home/dockes/projets/fulltext/recoll/src/lib)
+target_link_libraries(kio_recoll rcl xapian ${KDE4_KIO_LIBS})
+
+
+install(TARGETS kio_recoll DESTINATION ${PLUGIN_INSTALL_DIR})
+install(FILES recoll.protocol DESTINATION ${SERVICES_INSTALL_DIR} )
diff --git a/src/kde/kioslave/recoll/Makefile b/src/kde/kioslave/recoll/Makefile
index 634087f7..2ae9a1ce 100644
--- a/src/kde/kioslave/recoll/Makefile
+++ b/src/kde/kioslave/recoll/Makefile
@@ -1,59 +1,269 @@
-depth=../../..
-include $(depth)/mk/sysconf
+# CMAKE generated file: DO NOT EDIT!
+# Generated by "Unix Makefiles" Generator, CMake Version 2.6
-# Need to set this by hand until we decide how to autoconf this without
-# bringing 2mbytes of kde config files.
-# May also need to adjust stuff such as the --rpath's below
-#
-KDE_INCLUDES=/usr/include/kde
-QT_INCLUDES=/usr/include/qt3
+# Default target executed when no arguments are given to make.
+default_target: all
+.PHONY : default_target
+
+#=============================================================================
+# Special targets provided by cmake.
+
+# Disable implicit rules so canoncical targets will work.
+.SUFFIXES:
+
+# Remove some rules from gmake that .SUFFIXES does not remove.
+SUFFIXES =
+
+.SUFFIXES: .hpux_make_needs_suffix_list
+
+# Suppress display of executed commands.
+$(VERBOSE).SILENT:
+
+# A target that is always out of date.
+cmake_force:
+.PHONY : cmake_force
+
+#=============================================================================
+# Set environment variables for the build.
+
+# The shell in which to execute make rules.
+SHELL = /bin/sh
+
+# The CMake executable.
+CMAKE_COMMAND = /usr/bin/cmake
+
+# The command to remove a file.
+RM = /usr/bin/cmake -E remove -f
+
+# The program to use to edit the cache.
+CMAKE_EDIT_COMMAND = /usr/bin/ccmake
+
+# The top-level source directory on which CMake was run.
+CMAKE_SOURCE_DIR = /home/dockes/projets/fulltext/recoll/src/kde/kioslave/recoll
+
+# The top-level build directory on which CMake was run.
+CMAKE_BINARY_DIR = /home/dockes/projets/fulltext/recoll/src/kde/kioslave/recoll
+
+#=============================================================================
+# Targets provided globally by CMake.
+
+# Special rule for the target edit_cache
+edit_cache:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
+ /usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : edit_cache
+
+# Special rule for the target edit_cache
+edit_cache/fast: edit_cache
+.PHONY : edit_cache/fast
+
+# Special rule for the target install
+install: preinstall
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
+ /usr/bin/cmake -P cmake_install.cmake
+.PHONY : install
+
+# Special rule for the target install
+install/fast: preinstall/fast
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
+ /usr/bin/cmake -P cmake_install.cmake
+.PHONY : install/fast
+
+# Special rule for the target install/local
+install/local: preinstall
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
+ /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
+.PHONY : install/local
+
+# Special rule for the target install/local
+install/local/fast: install/local
+.PHONY : install/local/fast
+
+# Special rule for the target install/strip
+install/strip: preinstall
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
+ /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
+.PHONY : install/strip
+
+# Special rule for the target install/strip
+install/strip/fast: install/strip
+.PHONY : install/strip/fast
+
+# Special rule for the target list_install_components
+list_install_components:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
+.PHONY : list_install_components
+
+# Special rule for the target list_install_components
+list_install_components/fast: list_install_components
+.PHONY : list_install_components/fast
+
+# Special rule for the target package
+package: preinstall
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool..."
+ /usr/bin/cpack --config /home/dockes/projets/fulltext/recoll/src/kde/kioslave/recoll/CPackConfig.cmake
+.PHONY : package
+
+# Special rule for the target package
+package/fast: package
+.PHONY : package/fast
+
+# Special rule for the target package_source
+package_source:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool for source..."
+ /usr/bin/cpack --config /home/dockes/projets/fulltext/recoll/src/kde/kioslave/recoll/CPackSourceConfig.cmake
+.PHONY : package_source
+
+# Special rule for the target package_source
+package_source/fast: package_source
+.PHONY : package_source/fast
+
+# Special rule for the target rebuild_cache
+rebuild_cache:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
+ /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : rebuild_cache
+
+# Special rule for the target rebuild_cache
+rebuild_cache/fast: rebuild_cache
+.PHONY : rebuild_cache/fast
+
+# Special rule for the target test
+test:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests..."
+ /usr/bin/ctest --force-new-ctest-process $(ARGS)
+.PHONY : test
+
+# Special rule for the target test
+test/fast: test
+.PHONY : test/fast
+
+# The main all target
+all: cmake_check_build_system
+ $(CMAKE_COMMAND) -E cmake_progress_start /home/dockes/projets/fulltext/recoll/src/kde/kioslave/recoll/CMakeFiles /home/dockes/projets/fulltext/recoll/src/kde/kioslave/recoll/CMakeFiles/progress.make
+ $(MAKE) -f CMakeFiles/Makefile2 all
+ $(CMAKE_COMMAND) -E cmake_progress_start /home/dockes/projets/fulltext/recoll/src/kde/kioslave/recoll/CMakeFiles 0
+.PHONY : all
+
+# The main clean target
+clean:
+ $(MAKE) -f CMakeFiles/Makefile2 clean
+.PHONY : clean
+
+# The main clean target
+clean/fast: clean
+.PHONY : clean/fast
+
+# Prepare targets for installation.
+preinstall: all
+ $(MAKE) -f CMakeFiles/Makefile2 preinstall
+.PHONY : preinstall
+
+# Prepare targets for installation.
+preinstall/fast:
+ $(MAKE) -f CMakeFiles/Makefile2 preinstall
+.PHONY : preinstall/fast
+
+# clear depends
+depend:
+ $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
+.PHONY : depend
+
+#=============================================================================
+# Target rules for targets named kio_recoll
+
+# Build rule for target.
+kio_recoll: cmake_check_build_system
+ $(MAKE) -f CMakeFiles/Makefile2 kio_recoll
+.PHONY : kio_recoll
+
+# fast build rule for target.
+kio_recoll/fast:
+ $(MAKE) -f CMakeFiles/kio_recoll.dir/build.make CMakeFiles/kio_recoll.dir/build
+.PHONY : kio_recoll/fast
+
+# Manual pre-install relink rule for target.
+kio_recoll/preinstall:
+ $(MAKE) -f CMakeFiles/kio_recoll.dir/build.make CMakeFiles/kio_recoll.dir/preinstall
+.PHONY : kio_recoll/preinstall
+
+#=============================================================================
+# Target rules for targets named uninstall
+
+# Build rule for target.
+uninstall: cmake_check_build_system
+ $(MAKE) -f CMakeFiles/Makefile2 uninstall
+.PHONY : uninstall
+
+# fast build rule for target.
+uninstall/fast:
+ $(MAKE) -f CMakeFiles/uninstall.dir/build.make CMakeFiles/uninstall.dir/build
+.PHONY : uninstall/fast
+
+# target to build an object file
+kio_recoll.o:
+ $(MAKE) -f CMakeFiles/kio_recoll.dir/build.make CMakeFiles/kio_recoll.dir/kio_recoll.o
+.PHONY : kio_recoll.o
+
+# target to preprocess a source file
+kio_recoll.i:
+ $(MAKE) -f CMakeFiles/kio_recoll.dir/build.make CMakeFiles/kio_recoll.dir/kio_recoll.i
+.PHONY : kio_recoll.i
+
+# target to generate assembly for a file
+kio_recoll.s:
+ $(MAKE) -f CMakeFiles/kio_recoll.dir/build.make CMakeFiles/kio_recoll.dir/kio_recoll.s
+.PHONY : kio_recoll.s
+
+# target to build an object file
+kio_recoll_automoc.o:
+ $(MAKE) -f CMakeFiles/kio_recoll.dir/build.make CMakeFiles/kio_recoll.dir/kio_recoll_automoc.o
+.PHONY : kio_recoll_automoc.o
+
+# target to preprocess a source file
+kio_recoll_automoc.i:
+ $(MAKE) -f CMakeFiles/kio_recoll.dir/build.make CMakeFiles/kio_recoll.dir/kio_recoll_automoc.i
+.PHONY : kio_recoll_automoc.i
+
+# target to generate assembly for a file
+kio_recoll_automoc.s:
+ $(MAKE) -f CMakeFiles/kio_recoll.dir/build.make CMakeFiles/kio_recoll.dir/kio_recoll_automoc.s
+.PHONY : kio_recoll_automoc.s
+
+# Help Target
+help:
+ @echo "The following are some of the valid targets for this Makefile:"
+ @echo "... all (the default if no target is provided)"
+ @echo "... clean"
+ @echo "... depend"
+ @echo "... edit_cache"
+ @echo "... install"
+ @echo "... install/local"
+ @echo "... install/strip"
+ @echo "... kio_recoll"
+ @echo "... list_install_components"
+ @echo "... package"
+ @echo "... package_source"
+ @echo "... rebuild_cache"
+ @echo "... test"
+ @echo "... uninstall"
+ @echo "... kio_recoll.o"
+ @echo "... kio_recoll.i"
+ @echo "... kio_recoll.s"
+ @echo "... kio_recoll_automoc.o"
+ @echo "... kio_recoll_automoc.i"
+ @echo "... kio_recoll_automoc.s"
+.PHONY : help
-all: kio_recoll.so
-DEPS_CXXFLAGS = -MT pop3.lo -MD -MP -MF .deps/pop3.Tpo
+#=============================================================================
+# Special targets to cleanup operation of make.
-INC_CXXFLAGS = -I. \
- -I$(KDE_INCLUDES) -I$(QT_INCLUDES) \
- -I$(depth)/common -I$(depth)/query -I$(depth)/utils \
- -I$(depth)/qtgui -I$(depth)/rcldb
+# Special rule to run CMake to check the build system integrity.
+# No rule that depends on this can have commands that come from listfiles
+# because they might be regenerated.
+cmake_check_build_system:
+ $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+.PHONY : cmake_check_build_system
-PIC_CXXFLAGS = -fPIC -DPIC
-DEBUG_CXXFLAGS = -DNDEBUG -DNO_DEBUG -O2 -O
-LANG_CXXFLAGS = -fno-exceptions -fno-check-new -fno-common
-QT_CXXFLAGS = -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL \
- -DQT_NO_COMPAT -DQT_NO_TRANSLATION -DQT_THREAD_SUPPORT
-SYS_CXXFLAGS = -D_GNU_SOURCE
-THREAD_CXXFLAGS = -D_THREAD_SAFE -pthread -D_THREAD_SAFE -pthread
-
-
-# -rpath=/usr/lib:/usr/local/lib \
-
-LDFLAGS = \
- -Wl,--rpath -Wl,/usr/local/lib \
- -Wl,--rpath -Wl,/usr/X11R6/lib \
- -Wl,-export-dynamic -Wl,-soname -Wl,kio_recoll.so
-THREAD_LDFLAGS = -pthread
-
-kio_recoll.so : kio_recoll.o libpic
- c++ -shared $(LDFLAGS) $(THREAD_LDFLAGS) \
- -Wl,--no-undefined \
- kio_recoll.o piclib/librcl.a \
- $(LIBXAPIAN) $(LIBICONV) \
- -L/opt/kde3/lib -L/usr/local/lib -L/usr/X11R6/lib -lkio -lkdecore \
- -L/usr/lib/qt3/lib -lqt-mt \
- -L/usr/lib -lstdc++ -lm -lc \
- -o kio_recoll.so
-
-kio_recoll.o : kio_recoll.cpp kio_recoll.h
- $(CXX) -c -pipe kio_recoll.cpp $(INC_CXXFLAGS) $(PIC_CXXFLAGS) \
- $(DEBUG_CXXFLAGS) $(LANG_CXXFLAGS) $(QT_CXXFLAGS) $(SYS_CXXFLAGS) \
- $(THREAD_CXXFLAGS) \
- -o kio_recoll.o
-
-libpic:
- cd piclib;test -f Makefile || depth=$(depth)/.. sh $(depth)/../lib/mkMake
- cd piclib;$(MAKE) CXXFLAGS="$(CXXFLAGS) $(PIC_CXXFLAGS)" \
- CFLAGS="$(CFLAGS) $(PIC_CXXFLAGS)"
-
-.PHONY: all libpic
diff --git a/src/kde/kioslave/recoll/Makefile.kde3 b/src/kde/kioslave/recoll/Makefile.kde3
new file mode 100644
index 00000000..634087f7
--- /dev/null
+++ b/src/kde/kioslave/recoll/Makefile.kde3
@@ -0,0 +1,59 @@
+depth=../../..
+include $(depth)/mk/sysconf
+
+# Need to set this by hand until we decide how to autoconf this without
+# bringing 2mbytes of kde config files.
+# May also need to adjust stuff such as the --rpath's below
+#
+KDE_INCLUDES=/usr/include/kde
+QT_INCLUDES=/usr/include/qt3
+
+
+all: kio_recoll.so
+
+DEPS_CXXFLAGS = -MT pop3.lo -MD -MP -MF .deps/pop3.Tpo
+
+INC_CXXFLAGS = -I. \
+ -I$(KDE_INCLUDES) -I$(QT_INCLUDES) \
+ -I$(depth)/common -I$(depth)/query -I$(depth)/utils \
+ -I$(depth)/qtgui -I$(depth)/rcldb
+
+PIC_CXXFLAGS = -fPIC -DPIC
+DEBUG_CXXFLAGS = -DNDEBUG -DNO_DEBUG -O2 -O
+LANG_CXXFLAGS = -fno-exceptions -fno-check-new -fno-common
+QT_CXXFLAGS = -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL \
+ -DQT_NO_COMPAT -DQT_NO_TRANSLATION -DQT_THREAD_SUPPORT
+SYS_CXXFLAGS = -D_GNU_SOURCE
+THREAD_CXXFLAGS = -D_THREAD_SAFE -pthread -D_THREAD_SAFE -pthread
+
+
+# -rpath=/usr/lib:/usr/local/lib \
+
+LDFLAGS = \
+ -Wl,--rpath -Wl,/usr/local/lib \
+ -Wl,--rpath -Wl,/usr/X11R6/lib \
+ -Wl,-export-dynamic -Wl,-soname -Wl,kio_recoll.so
+THREAD_LDFLAGS = -pthread
+
+kio_recoll.so : kio_recoll.o libpic
+ c++ -shared $(LDFLAGS) $(THREAD_LDFLAGS) \
+ -Wl,--no-undefined \
+ kio_recoll.o piclib/librcl.a \
+ $(LIBXAPIAN) $(LIBICONV) \
+ -L/opt/kde3/lib -L/usr/local/lib -L/usr/X11R6/lib -lkio -lkdecore \
+ -L/usr/lib/qt3/lib -lqt-mt \
+ -L/usr/lib -lstdc++ -lm -lc \
+ -o kio_recoll.so
+
+kio_recoll.o : kio_recoll.cpp kio_recoll.h
+ $(CXX) -c -pipe kio_recoll.cpp $(INC_CXXFLAGS) $(PIC_CXXFLAGS) \
+ $(DEBUG_CXXFLAGS) $(LANG_CXXFLAGS) $(QT_CXXFLAGS) $(SYS_CXXFLAGS) \
+ $(THREAD_CXXFLAGS) \
+ -o kio_recoll.o
+
+libpic:
+ cd piclib;test -f Makefile || depth=$(depth)/.. sh $(depth)/../lib/mkMake
+ cd piclib;$(MAKE) CXXFLAGS="$(CXXFLAGS) $(PIC_CXXFLAGS)" \
+ CFLAGS="$(CFLAGS) $(PIC_CXXFLAGS)"
+
+.PHONY: all libpic
diff --git a/src/kde/kioslave/recoll/kio_recoll.cpp b/src/kde/kioslave/recoll/kio_recoll.cpp
index 3f1377c1..60e0b106 100644
--- a/src/kde/kioslave/recoll/kio_recoll.cpp
+++ b/src/kde/kioslave/recoll/kio_recoll.cpp
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.12 2008-11-14 15:49:03 dockes Exp $ (C) 2005 J.F.Dockes";
+static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.13 2008-11-17 14:51:38 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
#include
@@ -10,10 +10,22 @@ static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.12 2008-11-14 15:49:03 dockes
#include
using namespace std;
+#include
+#if (QT_VERSION < 0x040000)
#include
+#include
+#include
+#else
+#include
+#include
+#include
+#endif
-#include
+#include
+
+//#include
+#include
#include "rclconfig.h"
#include "rcldb.h"
@@ -23,18 +35,17 @@ using namespace std;
#include "rclquery.h"
#include "wasastringtoquery.h"
#include "wasatorcl.h"
-#include "plaintorich.h"
-
#include "kio_recoll.h"
using namespace KIO;
+
static RclConfig *rclconfig;
RclConfig *RclConfig::getMainConfig()
{
return rclconfig;
}
-RecollProtocol::RecollProtocol(const QCString &pool, const QCString &app)
+RecollProtocol::RecollProtocol(const QByteArray &pool, const QByteArray &app)
: SlaveBase("recoll", pool, app), m_initok(false),
m_rclconfig(0), m_rcldb(0)
{
@@ -67,6 +78,12 @@ RecollProtocol::~RecollProtocol()
delete m_rclconfig;
}
+void RecollProtocol::mimetype(const KUrl & /*url*/)
+{
+ mimeType("text/html");
+ finished();
+}
+
bool RecollProtocol::maybeOpenDb(string &reason)
{
if (!m_rcldb) {
@@ -82,9 +99,9 @@ bool RecollProtocol::maybeOpenDb(string &reason)
return true;
}
-void RecollProtocol::get(const KURL & url)
+void RecollProtocol::get(const KUrl & url)
{
- fprintf(stderr, "RecollProtocol::get %s\n", url.url().ascii());
+ kDebug(7130) << "RecollProtocol::get:" << url << endl;
mimeType("text/html");
if (!m_initok || !maybeOpenDb(m_reason)) {
@@ -102,8 +119,8 @@ void RecollProtocol::get(const KURL & url)
}
QString path = url.path();
- fprintf(stderr, "RecollProtocol::get:path [%s]\n", path.latin1());
- QCString u8 = path.utf8();
+ kDebug(7130) << "RecollProtocol::get:path:" << path << endl;
+ QByteArray u8 = path.toUtf8();
RefCntr sdata = wasaStringToRcl((const char*)u8, m_reason);
sdata->setStemlang("english");
@@ -119,8 +136,8 @@ void RecollProtocol::get(const KURL & url)
string explain = sdata->getDescription();
QByteArray output;
- QTextStream os(output, IO_WriteOnly );
- os.setEncoding(QTextStream::UnicodeUTF8);
+ QTextStream os(&output, QIODevice::ReadWrite);
+
os << "" << endl;
os << "" << endl;
os << "" << endl;
@@ -128,7 +145,6 @@ void RecollProtocol::get(const KURL & url)
os << "Recoll: query results" << endl;
os << "" << endl;
- // outputError("EXPLAINING");
os << "Actual query performed: " << endl;
os << explain.c_str() << "
";
@@ -141,7 +157,7 @@ void RecollProtocol::get(const KURL & url)
if (!query->getDoc(i, doc)) {
// This may very well happen for history if the doc has
// been removed since. So don't treat it as fatal.
- doc.meta["abstract"] = string("Unavailable document");
+ doc.meta[Rcl::Doc::keykw] = string("Unavailable document");
}
string iconname = m_rclconfig->getMimeIconName(doc.mimetype);
@@ -157,8 +173,8 @@ void RecollProtocol::get(const KURL & url)
char perbuf[10];
sprintf(perbuf, "%3d%%", doc.pc);
- if (doc.meta["title"].empty())
- doc.meta["title"] = path_getsimple(doc.url);
+ if (doc.meta[Rcl::Doc::keytt].empty())
+ doc.meta[Rcl::Doc::keytt] = path_getsimple(doc.url);
char datebuf[100];
datebuf[0] = 0;
if (!doc.dmtime.empty() || !doc.fmtime.empty()) {
@@ -170,12 +186,12 @@ void RecollProtocol::get(const KURL & url)
}
result += "" +
"
" + "";
- string abst = escapeHtml(doc.meta["abstract"]);
- result += string(perbuf) + " " + doc.meta["title"] + "
" +
+ string abst = escapeHtml(doc.meta[Rcl::Doc::keyabs]);
+ result += string(perbuf) + " " + doc.meta[Rcl::Doc::keytt] + "
" +
doc.mimetype + " " +
(datebuf[0] ? string(datebuf) + "
" : string("
")) +
(!abst.empty() ? abst + "
" : string("")) +
- (!doc.meta["keywords"].empty() ? doc.meta["keywords"] +
+ (!doc.meta[Rcl::Doc::keytt].empty() ? doc.meta[Rcl::Doc::keykw] +
"
" : string("")) +
"" + doc.url + "
\n";
@@ -186,17 +202,14 @@ void RecollProtocol::get(const KURL & url)
os << "";
data(output);
- data(QByteArray());
-
- fprintf(stderr, "RecollProtocol::get: calling finished\n");
+ kDebug(7130) << "call finished" << endl;
finished();
}
void RecollProtocol::outputError(const QString& errmsg)
{
QByteArray array;
- QTextStream os(array, IO_WriteOnly);
- os.setEncoding(QTextStream::UnicodeUTF8);
+ QTextStream os(&array, QIODevice::WriteOnly);
os << "" << endl;
os << "" << endl;
@@ -204,26 +217,33 @@ void RecollProtocol::outputError(const QString& errmsg)
os << "" << endl;
os << "Recoll Error
" << errmsg << "" << endl;
os << "" << endl;
-
data(array);
}
-extern "C" { int KDE_EXPORT kdemain(int argc, char **argv); }
+extern "C" {int kdemain(int argc, char **argv);}
int kdemain(int argc, char **argv)
{
- fprintf(stderr, "KIO_RECOLL\n");
- KInstance instance("kio_recoll");
+ FILE*mf = fopen("/tmp/toto","w");
+ fprintf(mf, "KIORECOLL\n");
+ fclose(mf);
+#ifdef KDE_VERSION_3
+ KInstance instance("kio_recoll");
+#else
+ KComponentData instance("kio_recoll");
+#endif
+ kDebug(7130) << "*** starting kio_recoll " << endl;
- if (argc != 4) {
- fprintf(stderr,
- "Usage: kio_recoll protocol domain-socket1 domain-socket2\n");
- exit(-1);
- }
+ if (argc != 4) {
+ kDebug(7130) << "Usage: kio_recoll proto dom-socket1 dom-socket2\n" << endl;
+ exit(-1);
+ }
- RecollProtocol slave(argv[2], argv[3]);
- slave.dispatchLoop();
+ RecollProtocol slave(argv[2], argv[3]);
+ slave.dispatchLoop();
- return 0;
+ kDebug(7130) << "kio_recoll Done" << endl;
+ return 0;
}
+
diff --git a/src/kde/kioslave/recoll/kio_recoll.h b/src/kde/kioslave/recoll/kio_recoll.h
index 2b8ce6eb..1ec47034 100644
--- a/src/kde/kioslave/recoll/kio_recoll.h
+++ b/src/kde/kioslave/recoll/kio_recoll.h
@@ -1,17 +1,28 @@
#ifndef _RECOLL_H
-/* @(#$Id: kio_recoll.h,v 1.4 2008-11-14 15:49:03 dockes Exp $ (C) 2005 J.F.Dockes */
+/* @(#$Id: kio_recoll.h,v 1.5 2008-11-17 14:51:38 dockes Exp $ (C) 2005 J.F.Dockes */
#define _RECOLL_H
#include
+using std::string;
+#include
+
+#if (QT_VERSION < 0x040000)
+#include
+#else
+#include
+#endif
+
+#include
#include
#include
class RecollProtocol : public KIO::SlaveBase {
public:
- RecollProtocol( const QCString &pool, const QCString &app );
+ RecollProtocol(const QByteArray &pool, const QByteArray &app );
virtual ~RecollProtocol();
- virtual void get( const KURL & url );
+ virtual void mimetype(const KUrl & url );
+ virtual void get(const KUrl & url );
private:
bool m_initok;
@@ -22,5 +33,6 @@ class RecollProtocol : public KIO::SlaveBase {
bool maybeOpenDb(string &reason);
void outputError(const QString& errmsg);
};
+extern "C" {int kdemain(int, char**);}
#endif // _RECOLL_H