diff --git a/src/kde/kioslave/recoll/CMakeLists.txt b/src/kde/kioslave/recoll/CMakeLists.txt index ed553b98..20753667 100644 --- a/src/kde/kioslave/recoll/CMakeLists.txt +++ b/src/kde/kioslave/recoll/CMakeLists.txt @@ -115,6 +115,13 @@ kde4_add_plugin(kio_recoll ${kio_recoll_SRCS}) target_link_libraries(kio_recoll xapian ${EXTRA_LIBS} ${KDE4_KIO_LIBS}) install(TARGETS kio_recoll DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES recoll.protocol DESTINATION ${SERVICES_INSTALL_DIR}) + +IF ("${KDE_VERSION_MAJOR}.${KDE_VERSION_MINOR}" GREATER 4.0) + install(FILES recoll.protocol DESTINATION ${SERVICES_INSTALL_DIR}) +ELSE ("${KDE_VERSION_MAJOR}.${KDE_VERSION_MINOR}" GREATER 4.0) + install(FILES recollnolist.protocol DESTINATION ${SERVICES_INSTALL_DIR} + RENAME recoll.protocol) +ENDIF ("${KDE_VERSION_MAJOR}.${KDE_VERSION_MINOR}" GREATER 4.0) + install(FILES data/welcome.html DESTINATION ${DATA_INSTALL_DIR}/kio_recoll) diff --git a/src/kde/kioslave/recoll/dirif.cpp b/src/kde/kioslave/recoll/dirif.cpp index 0678f53e..2d9c3170 100644 --- a/src/kde/kioslave/recoll/dirif.cpp +++ b/src/kde/kioslave/recoll/dirif.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: dirif.cpp,v 1.2 2008-11-27 17:48:43 dockes Exp $ (C) 2008 J.F.Dockes"; +static char rcsid[] = "@(#$Id: dirif.cpp,v 1.3 2008-11-28 09:14:42 dockes Exp $ (C) 2008 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -27,6 +27,12 @@ static char rcsid[] = "@(#$Id: dirif.cpp,v 1.2 2008-11-27 17:48:43 dockes Exp $ * Stephan Binner */ +#include +#if KDE_IS_VERSION(4,1,0) +// Couldn't get listDir() to work with kde 4.0, konqueror keeps +// crashing because of kdirmodel, couldn't find a workaround (not +// saying it's impossible)... + #include #include @@ -34,11 +40,27 @@ static char rcsid[] = "@(#$Id: dirif.cpp,v 1.2 2008-11-27 17:48:43 dockes Exp $ #include - #include "kio_recoll.h" - using namespace KIO; +void RecollProtocol::stat(const KUrl & url) +{ + kDebug() << url << endl ; + + QString path = url.path(); + KIO::UDSEntry entry; + if (!path.compare("/")) + entry.insert(KIO::UDSEntry::UDS_NAME, "/welcome"); + else + entry.insert(KIO::UDSEntry::UDS_NAME, url.path()); + entry.insert(KIO::UDSEntry::UDS_TARGET_URL, url.url()); + entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG); + statEntry(entry); + finished(); +} + + + const UDSEntry resultToUDSEntry(Rcl::Doc doc) { @@ -72,22 +94,6 @@ const UDSEntry resultToUDSEntry(Rcl::Doc doc) } -void RecollProtocol::stat(const KUrl & url) -{ - kDebug() << url << endl ; - - QString path = url.path(); - KIO::UDSEntry entry; - if (!path.compare("/")) - entry.insert(KIO::UDSEntry::UDS_NAME, "/welcome"); - else - entry.insert(KIO::UDSEntry::UDS_NAME, url.path()); - entry.insert(KIO::UDSEntry::UDS_TARGET_URL, url.url()); - entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG); - statEntry(entry); - finished(); -} - // From kio_beagle void RecollProtocol::createRootEntry(KIO::UDSEntry& entry) { @@ -172,3 +178,4 @@ void RecollProtocol::listDir(const KUrl& url) listEntries(entries); finished(); } +#endif // KDE 4.1+ diff --git a/src/kde/kioslave/recoll/kio_recoll.cpp b/src/kde/kioslave/recoll/kio_recoll.cpp index ea1dfa9f..36ae31b9 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.17 2008-11-27 17:48:43 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.18 2008-11-28 09:14:42 dockes Exp $ (C) 2005 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -119,11 +119,7 @@ bool RecollProtocol::maybeOpenDb(string &reason) void RecollProtocol::mimetype(const KUrl &url) { kDebug() << url << endl; -#ifdef USEDIRMODEL - mimeType("inode/directory"); -#else - mimeType("text/html"); -#endif + mimeType("text/html"); finished(); } @@ -154,17 +150,14 @@ void RecollProtocol::get(const KUrl & url) error(KIO::ERR_SLAVE_DEFINED, reason.c_str()); return; } -#ifdef USEDIRMODEL - error(KIO::ERR_IS_DIRECTORY, QString::null); - return; -#endif QString host = url.host(); QString path = url.path(); kDebug() << "host:" << host << " path:" << path; - if (host.isEmpty() && (!path.compare("/")||!path.compare("/welcome"))) { + if (host.isEmpty() && + (path.isEmpty() || !path.compare("/")||!path.compare("/welcome"))) { // recoll:/ welcomePage(); goto out; diff --git a/src/kde/kioslave/recoll/kio_recoll.h b/src/kde/kioslave/recoll/kio_recoll.h index 803f44df..6a8c19ad 100644 --- a/src/kde/kioslave/recoll/kio_recoll.h +++ b/src/kde/kioslave/recoll/kio_recoll.h @@ -1,5 +1,5 @@ #ifndef _RECOLL_H -/* @(#$Id: kio_recoll.h,v 1.8 2008-11-27 17:48:43 dockes Exp $ (C) 2005 J.F.Dockes */ +/* @(#$Id: kio_recoll.h,v 1.9 2008-11-28 09:14:42 dockes Exp $ (C) 2005 J.F.Dockes */ #define _RECOLL_H /* * This program is free software; you can redistribute it and/or modify @@ -32,6 +32,7 @@ using std::string; #include #include #include +#include #include "rclconfig.h" #include "rcldb.h" @@ -62,8 +63,10 @@ class RecollProtocol : public KIO::SlaveBase { virtual ~RecollProtocol(); virtual void mimetype(const KUrl & url ); virtual void get(const KUrl & url ); +#if KDE_IS_VERSION(4,1,0) virtual void stat(const KUrl & url); virtual void listDir(const KUrl& url); +#endif static RclConfig *o_rclconfig; diff --git a/src/kde/kioslave/recoll/notes.txt b/src/kde/kioslave/recoll/notes.txt index 762993fb..d3a5cf24 100644 --- a/src/kde/kioslave/recoll/notes.txt +++ b/src/kde/kioslave/recoll/notes.txt @@ -26,3 +26,11 @@ Output to ~/.xession-errors par defaut controle ? 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 +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" diff --git a/src/kde/kioslave/recoll/recoll.protocol b/src/kde/kioslave/recoll/recoll.protocol index 1907f620..c69fc77d 100644 --- a/src/kde/kioslave/recoll/recoll.protocol +++ b/src/kde/kioslave/recoll/recoll.protocol @@ -5,8 +5,7 @@ input=none output=filesystem listing=Name,Type, URL reading=true -#defaultMimeType=inode/directory defaultMimeType=text/html -Icon=help_index +Icon=recoll Class=:local URIMode=rawuri diff --git a/src/kde/kioslave/recoll/recollnolist.protocol b/src/kde/kioslave/recoll/recollnolist.protocol new file mode 100644 index 00000000..cb5d55e4 --- /dev/null +++ b/src/kde/kioslave/recoll/recollnolist.protocol @@ -0,0 +1,11 @@ +[Protocol] +exec=kio_recoll +protocol=recoll +input=none +output=filesystem +# Version for kde4.0: no "listing" entry +reading=true +defaultMimeType=text/html +Icon=recoll +Class=:local +URIMode=rawuri