kio goes to testing

This commit is contained in:
dockes 2008-12-02 13:14:01 +00:00
parent dbe29d4a7b
commit 8122500ca8
6 changed files with 215 additions and 155 deletions

View File

@ -1,77 +1,77 @@
Recoll KIO slave
================
This is a small experiment with a recoll kio_slave
This is a small experiment with a recoll KIO slave
A kio_slave was implemented, supporting the "get" operation. Ie, you type
"recoll: some query terms" in the Konqueror address window, and you receive
a list of results, each with a link to the document.
This does not appear terribly useful as such, especially because I couldn't
think of a way to get access to email documents from Konqueror (especially
those inside a multi-msg folder file, it's better with maildir). The Recoll
preview feature is actually quite useful in this case.
It does not appear terribly useful as such, especially because I
couldn't think of a way to get access to email documents from
Konqueror (especially those inside a multi-msg folder file, it's
better with maildir). The Recoll preview feature is actually quite
useful in this case. But anyway, here it is...
Building and installing:
-----------------------
This began under KDE3 and might still be made to work, but I only built
with KDE4 and cmake recently.
=======================
This began under KDE3 and might still be made to work, but I only
built with KDE4 and cmake recently. Full functionality is only
available with KDE 4.1 and later.
The main Recoll installation shares its prefix with the KIO slave,
which needs to use the KDE one. This means that, if KDE lives in /usr,
Recoll must be configured with --prefix=/usr, not /usr/local. Else
you'll have run-time problems, the slave will not be able to find the
recoll configuration.
A kind of recipe:
- You need the KDE4 core devel packages and cmake installed
- Extract the source and build recoll normally.
- Extract the recoll source, configure recoll with --prefix=/usr
build and install recoll (or use another prefix if KDE lives elsewhere).
- In the recoll source, go to kde/kioslave/recoll, then execute:
ccmake .
# type 'c', then change the install prefix from /usr/local to /usr, then
# 'c', 'g'
mkdir builddir
cd builddir
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install
- Note: there may be a way to install to a personal directory and avoid
being root, and somebody who knows more about kde will have to teach me
this.
- You should have a look at where "make install" copies things,
because wrong targets are frequent. Especially, you should check
that kio_recoll.so is copied to the right place, meaning among the
output of "kde4-config --path module". As an additional check,
there should be many other kio_[xxx].so in there. Same for the
protocol file, check that it's not alone in its directory (really,
this sounds strange, but, to this point, I've seen more systems
with broken cmake/KDE configs than correct ones).
- You should then be able to enter "recoll:" in the konqueror url, and
perform a recoll search (supposing you have an index already built of
course, the kio_slave doesn't deal with this for now).
You need to build/update the index with recollindex, the KIO slave
doesn't deal with it for now.
Implementation notes:
-----------------------
Misc build problems:
===================
- There would be two main ways to do this:
- a-la kio_beagle, using listDir() to list entries pointing to the
different operations or objects (help, status, search result
entries, bookmarks, whatever...). The nice thing is that the
results really look like file object in a directory (probably,
didn't try it actually), no need for look and feel, it's provided by
KDE
KUBUNTU 8.10 (updated to 2008-27-11)
------------------------------------
cmake generates a bad dependancy on
/build/buildd/kde4libs-4.1.2/obj-i486-linux-gnu/lib/libkdecore.so
inside CMakeFiles/kio_recoll.dir/build.make
- Or a la strigi: all interactions are through html pages and get()
operations. Looks less like a normal konqueror file-system
listing, and needs more html coding but all in all probably
simpler.
Found no way to fix this. You need to edit the line and replace the
/build/[...]/lib with /usr/lib. This manifests itself with the
following error message:
Recoll is currently doing the html thing. As far as I understand, the
way to trigger a listdir is to have a inode/directory default mime
type in the protocol file, and return inode/directory when
appropriate in mimetype() (look at kio_beagle). Some kde daemon needs
to be restarted when doing this (the protocol file is cached
somewhere).
make[2]: *** No rule to make target `/build/buildd/kde4libs-4.1.2/obj-i486-linux-gnu/lib/libkdecore.so', needed by `lib/kio_recoll.so'. Stop.
Usage
=====
You should then be able to enter "recoll:" in the konqueror URL
entry. Depending on the KDE version, this will bring you either to an
HTML search form, or to a directory listing, where you should read the
help file, which explains how to switch between the HTML and
directory-oriented interfaces.
Also would need a page header, configuration polish etc... Not done for
the same reason, this is a proof of concept.
KDE3 notes
- Not using libtool. Probably should. compilation flags in the Makefile
were copy-pasted from a kdebase compilation tree on FreeBSD (kio/man).
- You MUST install a kio_recoll.la in lib/kde3 along with kio_recoll.so,
else kdeinit won't be able to load the lib (probably uses the libltdl
thingy?). The one in this directory was duplicated/adjusted from
kio_man.la. The contents don't seem too critical, just needs to exist.
- If you want to try, compile, then install kio_recoll.la kio_recoll.so
wherever kde keeps its plugins (ie: lib/kde3), and recoll.protocol in the
services directory (share/services ? look for other .protocol file).
- I saw after doing the build/config mockup that kdevelop can generate a
kio_slave project. This might be the next thing to do. otoh would need to
separate the kio from the main source to avoid having to distribute 2megs
of kde build config files.

View File

@ -1,27 +1,6 @@
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})
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=7130
@ -31,8 +10,7 @@ add_definitions(-DKDE_DEFAULT_DEBUG_AREA=7130
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
set(depth ../../../)
set(rcltop ${CMAKE_CURRENT_SOURCE_DIR}/${depth})
set(rcltop ${CMAKE_CURRENT_SOURCE_DIR}/../../../)
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES}
${rcltop}/aspell
@ -47,58 +25,58 @@ include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES}
)
set(kio_recoll_SRCS kio_recoll.cpp htmlif.cpp dirif.cpp
${depth}/aspell/rclaspell.cpp
${depth}/bincimapmime/mime-getpart.cc
${depth}/bincimapmime/mime-parsefull.cc
${depth}/bincimapmime/mime-parseonlyheader.cc
${depth}/bincimapmime/mime-printbody.cc
${depth}/bincimapmime/mime-printdoc.cc
${depth}/bincimapmime/mime-printheader.cc
${depth}/bincimapmime/mime.cc
${depth}/bincimapmime/convert.cc
${depth}/bincimapmime/iodevice.cc
${depth}/bincimapmime/iofactory.cc
${depth}/common/rclconfig.cpp
${depth}/common/rclinit.cpp
${depth}/common/textsplit.cpp
${depth}/common/unacpp.cpp
${depth}/index/mimetype.cpp
${depth}/internfile/htmlparse.cpp
${depth}/internfile/myhtmlparse.cpp
${depth}/internfile/mimehandler.cpp
${depth}/internfile/mh_exec.cpp
${depth}/internfile/mh_html.cpp
${depth}/internfile/mh_mail.cpp
${depth}/internfile/mh_mbox.cpp
${depth}/internfile/mh_text.cpp
${depth}/query/docseq.cpp
${depth}/query/docseqdb.cpp
${depth}/query/plaintorich.cpp
${depth}/query/reslistpager.cpp
${depth}/query/wasastringtoquery.cpp
${depth}/query/wasatorcl.cpp
${depth}/rcldb/pathhash.cpp
${depth}/rcldb/rcldb.cpp
${depth}/rcldb/rcldoc.cpp
${depth}/rcldb/rclquery.cpp
${depth}/rcldb/searchdata.cpp
${depth}/rcldb/stemdb.cpp
${depth}/rcldb/stoplist.cpp
${depth}/unac/unac.c
${depth}/utils/base64.cpp
${depth}/utils/conftree.cpp
${depth}/utils/copyfile.cpp
${depth}/utils/debuglog.cpp
${depth}/utils/execmd.cpp
${depth}/utils/idfile.cpp
${depth}/utils/fileudi.cpp
${depth}/utils/md5.cpp
${depth}/utils/mimeparse.cpp
${depth}/utils/pathut.cpp
${depth}/utils/readfile.cpp
${depth}/utils/smallut.cpp
${depth}/utils/transcode.cpp
${depth}/utils/wipedir.cpp
${rcltop}/aspell/rclaspell.cpp
${rcltop}/bincimapmime/mime-getpart.cc
${rcltop}/bincimapmime/mime-parsefull.cc
${rcltop}/bincimapmime/mime-parseonlyheader.cc
${rcltop}/bincimapmime/mime-printbody.cc
${rcltop}/bincimapmime/mime-printdoc.cc
${rcltop}/bincimapmime/mime-printheader.cc
${rcltop}/bincimapmime/mime.cc
${rcltop}/bincimapmime/convert.cc
${rcltop}/bincimapmime/iodevice.cc
${rcltop}/bincimapmime/iofactory.cc
${rcltop}/common/rclconfig.cpp
${rcltop}/common/rclinit.cpp
${rcltop}/common/textsplit.cpp
${rcltop}/common/unacpp.cpp
${rcltop}/index/mimetype.cpp
${rcltop}/internfile/htmlparse.cpp
${rcltop}/internfile/myhtmlparse.cpp
${rcltop}/internfile/mimehandler.cpp
${rcltop}/internfile/mh_exec.cpp
${rcltop}/internfile/mh_html.cpp
${rcltop}/internfile/mh_mail.cpp
${rcltop}/internfile/mh_mbox.cpp
${rcltop}/internfile/mh_text.cpp
${rcltop}/query/docseq.cpp
${rcltop}/query/docseqdb.cpp
${rcltop}/query/plaintorich.cpp
${rcltop}/query/reslistpager.cpp
${rcltop}/query/wasastringtoquery.cpp
${rcltop}/query/wasatorcl.cpp
${rcltop}/rcldb/pathhash.cpp
${rcltop}/rcldb/rcldb.cpp
${rcltop}/rcldb/rcldoc.cpp
${rcltop}/rcldb/rclquery.cpp
${rcltop}/rcldb/searchdata.cpp
${rcltop}/rcldb/stemdb.cpp
${rcltop}/rcldb/stoplist.cpp
${rcltop}/unac/unac.c
${rcltop}/utils/base64.cpp
${rcltop}/utils/conftree.cpp
${rcltop}/utils/copyfile.cpp
${rcltop}/utils/debuglog.cpp
${rcltop}/utils/execmd.cpp
${rcltop}/utils/idfile.cpp
${rcltop}/utils/fileudi.cpp
${rcltop}/utils/md5.cpp
${rcltop}/utils/mimeparse.cpp
${rcltop}/utils/pathut.cpp
${rcltop}/utils/readfile.cpp
${rcltop}/utils/smallut.cpp
${rcltop}/utils/transcode.cpp
${rcltop}/utils/wipedir.cpp
)
CHECK_LIBRARY_EXISTS(dl dlopen "" DLOPEN_IN_LIBDL)

View File

@ -18,6 +18,10 @@
<input type="hidden" name="p" value="0">
Enter search string: <input type="text" name="q" size="40" value="%Q">
<input type="submit" value="Search">
%C
%S
</form>
</p>

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: htmlif.cpp,v 1.4 2008-12-01 18:42:52 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: htmlif.cpp,v 1.5 2008-12-02 13:14:01 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -124,9 +124,29 @@ void RecollProtocol::welcomePage()
welcomedata += "</p></body></html>";
}
}
string catgq;
#if 0
// Catg filtering. A bit complicated to do because of the
// stateless thing (one more thing to compare to check if same
// query) right now. Would be easy by adding to the query
// language, but not too useful in this case, so scrap it for now.
list<string> cats;
if (o_rclconfig->getMimeCategories(cats) && !cats.empty()) {
catgq = "<p>Filter on types: "
"<input type=\"radio\" name=\"ct\" value=\"All\" checked>All";
for (list<string>::iterator it = cats.begin(); it != cats.end();it++) {
catgq += "\n<input type=\"radio\" name=\"ct\" value=\"" +
*it + "\">" + *it ;
}
}
#endif
string tmp;
map<char, string> subs;
subs['Q'] = "";
subs['C'] = catgq;
subs['S'] = "";
pcSubst(welcomedata, tmp, subs);
data(tmp.c_str());
}

View File

@ -1,33 +1,50 @@
- Sur ubuntu et freebsd cmake installe
-- Installing /usr/lib/kde4/kio_recoll.so
Au lieu de /usr/lib/kde4/lib/kde4/kio_recoll.so
-- Installing /usr/share/kde4/services/recoll.protocol
Au lieu de /usr/lib/kde4/share/kde4/services/recoll.protocol
-- Installing /usr/share/apps/kio_recoll/welcome.html
Au lieu de /usr/lib/kde4/share/kde4/apps/
Implementation notes:
====================
- Il faut configurer cmake avec target /usr, donc attention a configurer
recoll avec --target=/usr pour que les fichiers de config soient au bon
endroit
- There would be two main ways to do this:
- a-la kio_beagle, using listDir() to list entries pointing to the
different operations or objects (help, status, search result
entries, bookmarks, whatever...). The nice thing is that the
results really look like file object in a directory (probably,
didn't try it actually), no need for look and feel, it's provided by
KDE
- Or a la strigi: all interactions are through html pages and get()
operations. Looks less like a normal konqueror file-system
listing, and needs more html coding but all in all probably
simpler.
Recoll is currently doing both things on KDE4.1 (only html for
KDE4.0). As far as I understand, the way to trigger a listdir is to
have a inode/directory default mime type in the protocol file, and
return inode/directory when appropriate in mimetype() (look at
kio_beagle). Some kde daemon needs to be restarted when doing this
(the protocol file is cached somewhere).
Sur kubuntu 8.10 (a jour au 2008-27-11), cmake genere une dependance sur
/build/buildd/kde4libs-4.1.2/obj-i486-linux-gnu/lib/libkdecore.so dans
CMakeFiles/kio_recoll.dir/build.make
Pas trouve le moyen de corriger, il faut editer la ligne et remplacer
par /usr/lib/..
TOdoes
======
- Improve the html interface to support more functions
- Category filtering
- Sorting
- Find a way to use the html form to enter the query and get the results
as a directory ?
- Would it be possible to use a redirect to switch to the
directory-oriented results for a query from the html form ?
KDE misc notes
==================
Debug areas: /usr/share/kde4/config/kdebug.areas
kdebugdialog [--fullmode] pour configurer
./.kde/share/config/kdebugrc
Output to ~/.xession-errors par defaut controle ?
Output to ~/.xession-errors by default. How to change ?
kio_recoll misc notes:
===========================
Probleme quand l'url se termine par un / et qu'on edite le mot,
konqueror lance une recherche a chaque lettre.
Apparemment c'est l'entree "listing" du .protocol qui decide si le plugin
est traité plutot comme un dirlister ou comme un htmlgetter. Curieusement,
le changement ne s'opere pas toujours immediatement quand on change le
@ -35,7 +52,8 @@ fichier .proto, y compris apres avoir tue tous les process kde (changement
à la deuxieme execution de konqueror sur kde4.0). Sur kde4.0 il faut que le
.proto soit sans entree "listing"
Problemes de gestion de l'etat
===============================
Les KIO slaves ne sont pas associes a une fenetre ! ils sont
reutilises au hasard, et leur etat n'a aucune raison de correspondre a
celui de l'affichage. On peut tres bien avoir 1 fenetre 2 kio ou 1 kio
@ -54,3 +72,39 @@ C'est vrai aussi bien pour les dirlists que pour la version html.
J'ai essaye de mettre une boucle timeout callback callspecial() mais
ca ne sert a rien, c'est gere dans le process kio_slave, ca ne
maintient pas l'association avec un konqueror.
KDE_FORK_SLAVES resoudrait peut-etre la question ?
Old KDE3 notes,
===============
kio_recoll has not been checked or worked under KDE3 for eons, no
reason to believe it works.
- Not using libtool. Probably should. compilation flags in the Makefile
were copy-pasted from a kdebase compilation tree on FreeBSD (kio/man).
- You MUST install a kio_recoll.la in lib/kde3 along with kio_recoll.so,
else kdeinit won't be able to load the lib (probably uses the libltdl
thingy?). The one in this directory was duplicated/adjusted from
kio_man.la. The contents don't seem too critical, just needs to exist.
- If you want to try, compile, then install kio_recoll.la kio_recoll.so
wherever kde keeps its plugins (ie: lib/kde3), and recoll.protocol in the
services directory (share/services ? look for other .protocol file).
- I saw after doing the build/config mockup that kdevelop can generate a
kio_slave project. This might be the next thing to do. otoh would need to
separate the kio from the main source to avoid having to distribute 2megs
of kde build config files.

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: reslistpager.cpp,v 1.3 2008-11-27 14:05:16 dockes Exp $ (C) 2007 J.F.Dockes";
static char rcsid[] = "@(#$Id: reslistpager.cpp,v 1.4 2008-12-02 13:14:01 dockes Exp $ (C) 2007 J.F.Dockes";
#endif
#include <stdio.h>
@ -29,8 +29,10 @@ Prefs prefs = {true, true};
void ResListPager::resultPageNext()
{
if (m_docSource.isNull())
if (m_docSource.isNull()) {
LOGDEB(("ResListPager::displayPage: null source\n"));
return;
}
int resCnt = m_docSource->getResCnt();
LOGDEB(("ResListPager::resultPageNext: rescnt %d, winfirst %d\n",
@ -69,8 +71,10 @@ void ResListPager::resultPageNext()
void ResListPager::displayPage()
{
if (m_docSource.isNull())
if (m_docSource.isNull()) {
LOGDEB(("ResListPager::displayPage: null source\n"));
return;
}
string chunk;
// Display list header