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 It does not appear terribly useful as such, especially because I
"recoll: some query terms" in the Konqueror address window, and you receive couldn't think of a way to get access to email documents from
a list of results, each with a link to the document. Konqueror (especially those inside a multi-msg folder file, it's
better with maildir). The Recoll preview feature is actually quite
This does not appear terribly useful as such, especially because I couldn't useful in this case. But anyway, here it is...
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.
Building and installing: 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: A kind of recipe:
- You need the KDE4 core devel packages and cmake installed - 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: - In the recoll source, go to kde/kioslave/recoll, then execute:
ccmake . mkdir builddir
# type 'c', then change the install prefix from /usr/local to /usr, then cd builddir
# 'c', 'g' cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make make
sudo make install sudo make install
- Note: there may be a way to install to a personal directory and avoid - You should have a look at where "make install" copies things,
being root, and somebody who knows more about kde will have to teach me because wrong targets are frequent. Especially, you should check
this. 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 You need to build/update the index with recollindex, the KIO slave
perform a recoll search (supposing you have an index already built of doesn't deal with it for now.
course, the kio_slave doesn't deal with this for now).
Implementation notes: Misc build problems:
----------------------- ===================
- There would be two main ways to do this: KUBUNTU 8.10 (updated to 2008-27-11)
- a-la kio_beagle, using listDir() to list entries pointing to the ------------------------------------
different operations or objects (help, status, search result cmake generates a bad dependancy on
entries, bookmarks, whatever...). The nice thing is that the /build/buildd/kde4libs-4.1.2/obj-i486-linux-gnu/lib/libkdecore.so
results really look like file object in a directory (probably, inside CMakeFiles/kio_recoll.dir/build.make
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() Found no way to fix this. You need to edit the line and replace the
operations. Looks less like a normal konqueror file-system /build/[...]/lib with /usr/lib. This manifests itself with the
listing, and needs more html coding but all in all probably following error message:
simpler.
Recoll is currently doing the html thing. As far as I understand, the 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.
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 Usage
somewhere). =====
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) 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) find_package(KDE4 REQUIRED)
include(UsePkgConfig)
include(KDE4Defaults)
include(MacroLibrary)
include(MacroOptionalAddSubdirectory)
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=7130 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(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
set(depth ../../../) set(rcltop ${CMAKE_CURRENT_SOURCE_DIR}/../../../)
set(rcltop ${CMAKE_CURRENT_SOURCE_DIR}/${depth})
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES}
${rcltop}/aspell ${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 set(kio_recoll_SRCS kio_recoll.cpp htmlif.cpp dirif.cpp
${depth}/aspell/rclaspell.cpp ${rcltop}/aspell/rclaspell.cpp
${depth}/bincimapmime/mime-getpart.cc ${rcltop}/bincimapmime/mime-getpart.cc
${depth}/bincimapmime/mime-parsefull.cc ${rcltop}/bincimapmime/mime-parsefull.cc
${depth}/bincimapmime/mime-parseonlyheader.cc ${rcltop}/bincimapmime/mime-parseonlyheader.cc
${depth}/bincimapmime/mime-printbody.cc ${rcltop}/bincimapmime/mime-printbody.cc
${depth}/bincimapmime/mime-printdoc.cc ${rcltop}/bincimapmime/mime-printdoc.cc
${depth}/bincimapmime/mime-printheader.cc ${rcltop}/bincimapmime/mime-printheader.cc
${depth}/bincimapmime/mime.cc ${rcltop}/bincimapmime/mime.cc
${depth}/bincimapmime/convert.cc ${rcltop}/bincimapmime/convert.cc
${depth}/bincimapmime/iodevice.cc ${rcltop}/bincimapmime/iodevice.cc
${depth}/bincimapmime/iofactory.cc ${rcltop}/bincimapmime/iofactory.cc
${depth}/common/rclconfig.cpp ${rcltop}/common/rclconfig.cpp
${depth}/common/rclinit.cpp ${rcltop}/common/rclinit.cpp
${depth}/common/textsplit.cpp ${rcltop}/common/textsplit.cpp
${depth}/common/unacpp.cpp ${rcltop}/common/unacpp.cpp
${depth}/index/mimetype.cpp ${rcltop}/index/mimetype.cpp
${depth}/internfile/htmlparse.cpp ${rcltop}/internfile/htmlparse.cpp
${depth}/internfile/myhtmlparse.cpp ${rcltop}/internfile/myhtmlparse.cpp
${depth}/internfile/mimehandler.cpp ${rcltop}/internfile/mimehandler.cpp
${depth}/internfile/mh_exec.cpp ${rcltop}/internfile/mh_exec.cpp
${depth}/internfile/mh_html.cpp ${rcltop}/internfile/mh_html.cpp
${depth}/internfile/mh_mail.cpp ${rcltop}/internfile/mh_mail.cpp
${depth}/internfile/mh_mbox.cpp ${rcltop}/internfile/mh_mbox.cpp
${depth}/internfile/mh_text.cpp ${rcltop}/internfile/mh_text.cpp
${depth}/query/docseq.cpp ${rcltop}/query/docseq.cpp
${depth}/query/docseqdb.cpp ${rcltop}/query/docseqdb.cpp
${depth}/query/plaintorich.cpp ${rcltop}/query/plaintorich.cpp
${depth}/query/reslistpager.cpp ${rcltop}/query/reslistpager.cpp
${depth}/query/wasastringtoquery.cpp ${rcltop}/query/wasastringtoquery.cpp
${depth}/query/wasatorcl.cpp ${rcltop}/query/wasatorcl.cpp
${depth}/rcldb/pathhash.cpp ${rcltop}/rcldb/pathhash.cpp
${depth}/rcldb/rcldb.cpp ${rcltop}/rcldb/rcldb.cpp
${depth}/rcldb/rcldoc.cpp ${rcltop}/rcldb/rcldoc.cpp
${depth}/rcldb/rclquery.cpp ${rcltop}/rcldb/rclquery.cpp
${depth}/rcldb/searchdata.cpp ${rcltop}/rcldb/searchdata.cpp
${depth}/rcldb/stemdb.cpp ${rcltop}/rcldb/stemdb.cpp
${depth}/rcldb/stoplist.cpp ${rcltop}/rcldb/stoplist.cpp
${depth}/unac/unac.c ${rcltop}/unac/unac.c
${depth}/utils/base64.cpp ${rcltop}/utils/base64.cpp
${depth}/utils/conftree.cpp ${rcltop}/utils/conftree.cpp
${depth}/utils/copyfile.cpp ${rcltop}/utils/copyfile.cpp
${depth}/utils/debuglog.cpp ${rcltop}/utils/debuglog.cpp
${depth}/utils/execmd.cpp ${rcltop}/utils/execmd.cpp
${depth}/utils/idfile.cpp ${rcltop}/utils/idfile.cpp
${depth}/utils/fileudi.cpp ${rcltop}/utils/fileudi.cpp
${depth}/utils/md5.cpp ${rcltop}/utils/md5.cpp
${depth}/utils/mimeparse.cpp ${rcltop}/utils/mimeparse.cpp
${depth}/utils/pathut.cpp ${rcltop}/utils/pathut.cpp
${depth}/utils/readfile.cpp ${rcltop}/utils/readfile.cpp
${depth}/utils/smallut.cpp ${rcltop}/utils/smallut.cpp
${depth}/utils/transcode.cpp ${rcltop}/utils/transcode.cpp
${depth}/utils/wipedir.cpp ${rcltop}/utils/wipedir.cpp
) )
CHECK_LIBRARY_EXISTS(dl dlopen "" DLOPEN_IN_LIBDL) CHECK_LIBRARY_EXISTS(dl dlopen "" DLOPEN_IN_LIBDL)

View File

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

View File

@ -1,5 +1,5 @@
#ifndef lint #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 #endif
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -124,9 +124,29 @@ void RecollProtocol::welcomePage()
welcomedata += "</p></body></html>"; 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; string tmp;
map<char, string> subs; map<char, string> subs;
subs['Q'] = ""; subs['Q'] = "";
subs['C'] = catgq;
subs['S'] = "";
pcSubst(welcomedata, tmp, subs); pcSubst(welcomedata, tmp, subs);
data(tmp.c_str()); data(tmp.c_str());
} }

View File

@ -1,33 +1,50 @@
- Sur ubuntu et freebsd cmake installe Implementation notes:
-- 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/
- Il faut configurer cmake avec target /usr, donc attention a configurer - There would be two main ways to do this:
recoll avec --target=/usr pour que les fichiers de config soient au bon - a-la kio_beagle, using listDir() to list entries pointing to the
endroit 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 TOdoes
/build/buildd/kde4libs-4.1.2/obj-i486-linux-gnu/lib/libkdecore.so dans ======
CMakeFiles/kio_recoll.dir/build.make - Improve the html interface to support more functions
Pas trouve le moyen de corriger, il faut editer la ligne et remplacer - Category filtering
par /usr/lib/.. - 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 Debug areas: /usr/share/kde4/config/kdebug.areas
kdebugdialog [--fullmode] pour configurer kdebugdialog [--fullmode] pour configurer
./.kde/share/config/kdebugrc ./.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, Probleme quand l'url se termine par un / et qu'on edite le mot,
konqueror lance une recherche a chaque lettre. konqueror lance une recherche a chaque lettre.
Apparemment c'est l'entree "listing" du .protocol qui decide si le plugin Apparemment c'est l'entree "listing" du .protocol qui decide si le plugin
est traité plutot comme un dirlister ou comme un htmlgetter. Curieusement, est traité plutot comme un dirlister ou comme un htmlgetter. Curieusement,
le changement ne s'opere pas toujours immediatement quand on change le 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 à la deuxieme execution de konqueror sur kde4.0). Sur kde4.0 il faut que le
.proto soit sans entree "listing" .proto soit sans entree "listing"
Problemes de gestion de l'etat
===============================
Les KIO slaves ne sont pas associes a une fenetre ! ils sont 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 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 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 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 ca ne sert a rien, c'est gere dans le process kio_slave, ca ne
maintient pas l'association avec un konqueror. 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 #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 #endif
#include <stdio.h> #include <stdio.h>
@ -29,8 +29,10 @@ Prefs prefs = {true, true};
void ResListPager::resultPageNext() void ResListPager::resultPageNext()
{ {
if (m_docSource.isNull()) if (m_docSource.isNull()) {
LOGDEB(("ResListPager::displayPage: null source\n"));
return; return;
}
int resCnt = m_docSource->getResCnt(); int resCnt = m_docSource->getResCnt();
LOGDEB(("ResListPager::resultPageNext: rescnt %d, winfirst %d\n", LOGDEB(("ResListPager::resultPageNext: rescnt %d, winfirst %d\n",
@ -69,8 +71,10 @@ void ResListPager::resultPageNext()
void ResListPager::displayPage() void ResListPager::displayPage()
{ {
if (m_docSource.isNull()) if (m_docSource.isNull()) {
LOGDEB(("ResListPager::displayPage: null source\n"));
return; return;
}
string chunk; string chunk;
// Display list header // Display list header