listdir doesnt work on kde 4.0 because on parent/child assumptions in kdirmodel have to check on kde 4.1

This commit is contained in:
dockes 2008-11-26 15:03:41 +00:00
parent abafb31235
commit b4333737e4
8 changed files with 468 additions and 209 deletions

View File

@ -46,7 +46,7 @@ include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES}
${rcltop}/utils
)
set(kio_recoll_SRCS kio_recoll.cpp
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

View File

@ -0,0 +1,2 @@
#!/bin/sh
rm -rf CMakeCache.txt CMakeFiles cmake_install.cmake CMakeTmp cmake_uninstall.cmake CPackConfig.cmake CPackSourceConfig.cmake DartTestfile.txt install_manifest.txt kio_recoll_automoc.cpp kio_recoll_automoc.cpp.files kio_recoll.la kio_recoll.so lib Makefile

View File

@ -0,0 +1,118 @@
#ifndef lint
static char rcsid[] = "@(#$Id: dirif.cpp,v 1.1 2008-11-26 15:03:41 dockes Exp $ (C) 2008 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* A lot of code in this file was copied from kio_beagle 0.4.0,
* which is a GPL program. The authors listed are:
* Debajyoti Bera <dbera.web@gmail.com>
*
* KDE4 port:
* Stephan Binner <binner@kde.org>
*/
#include <sys/stat.h>
#include <kurl.h>
#include <kio/global.h>
#include <kdebug.h>
#include "kio_recoll.h"
using namespace KIO;
const UDSEntry resultToUDSEntry(Rcl::Doc doc)
{
UDSEntry entry;
KUrl url(doc.url.c_str());
kDebug() << doc.url.c_str();
entry.insert(KIO::UDSEntry::UDS_NAME, url.fileName());
if (!doc.mimetype.compare("application/x-fsdirectory")) {
entry.insert(KIO::UDSEntry::UDS_MIME_TYPE, "inode/directory");
entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
} else {
entry.insert(KIO::UDSEntry::UDS_MIME_TYPE, doc.mimetype.c_str());
entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG);
}
entry.insert(KIO::UDSEntry::UDS_LOCAL_PATH, url.path());
// For local files, supply the usual file stat information
struct stat info;
if (lstat(url.path().toAscii(), &info) >= 0) {
entry.insert( KIO::UDSEntry::UDS_SIZE, info.st_size);
entry.insert( KIO::UDSEntry::UDS_ACCESS, info.st_mode);
entry.insert( KIO::UDSEntry::UDS_MODIFICATION_TIME, info.st_mtime);
entry.insert( KIO::UDSEntry::UDS_ACCESS_TIME, info.st_atime);
entry.insert( KIO::UDSEntry::UDS_CREATION_TIME, info.st_ctime);
}
// entry.insert(KIO::UDSEntry::UDS_URL, doc.url.c_str());
// entry.insert(KIO::UDSEntry::UDS_URL, "recoll://search/query/1");
return entry;
}
// Don't know that we really need this. It's used by beagle to return
// info on the virtual entries used to execute commands, and on the
// saved searches (appearing as directories)
void RecollProtocol::stat(const KUrl & url)
{
kDebug() << url << endl ;
QString path = url.path();
KIO::UDSEntry entry;
entry.insert(KIO::UDSEntry::UDS_NAME, url.path());
entry.insert(KIO::UDSEntry::UDS_URL, url.url());
entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG);
statEntry(entry);
finished();
}
void RecollProtocol::listDir(const KUrl& url)
{
kDebug() << url << endl;
if (!m_initok || !maybeOpenDb(m_reason)) {
error(KIO::ERR_SLAVE_DEFINED, "Init error");
return;
}
QString query, opt;
URLToQuery(url, query, opt);
kDebug() << "Query: " << query;
if (!query.isEmpty()) {
doSearch(query, opt.toUtf8().at(0));
} else {
finished();
return;
}
vector<ResListEntry> page;
int pagelen = m_source->getSeqSlice(0, 20, page);
kDebug() << "Got " << pagelen << " results.";
UDSEntryList entries;
for (int i = 0; i < pagelen; i++) {
entries.append(resultToUDSEntry(page[i].doc));
}
listEntries(entries);
// finished();
}

View File

@ -0,0 +1,176 @@
#ifndef lint
static char rcsid[] = "@(#$Id: htmlif.cpp,v 1.1 2008-11-26 15:03:41 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string>
using namespace std;
#include <kdebug.h>
#include <kstandarddirs.h>
#include "rclconfig.h"
#include "rcldb.h"
#include "rclinit.h"
#include "pathut.h"
#include "searchdata.h"
#include "rclquery.h"
#include "wasastringtoquery.h"
#include "wasatorcl.h"
#include "kio_recoll.h"
#include "docseqdb.h"
#include "readfile.h"
#include "smallut.h"
using namespace KIO;
bool RecollKioPager::append(const string& data)
{
if (!m_parent) return false;
m_parent->data(QByteArray(data.c_str()));
return true;
}
string RecollKioPager::detailsLink()
{
string chunk = "<a href=\"recoll://command/QueryDetails\">";
chunk += tr("(show query)") + "</a>";
return chunk;
}
const static string parformat =
"<a href=\"%U\"><img src=\"%I\" align=\"left\"></a>"
"%R %S "
"<a href=\"%U\">Open</a>&nbsp;&nbsp;<b>%T</b><br>"
"%M&nbsp;%D&nbsp;&nbsp; <i>%U</i><br>"
"%A %K";
const string &RecollKioPager::parFormat()
{
return parformat;
}
string RecollKioPager::pageTop()
{
return "<p align=\"center\"><a href=\"recoll:///\">New Search</a></p>";
}
string RecollKioPager::nextUrl()
{
int pagenum = pageNumber();
if (pagenum < 0)
pagenum = 0;
else
pagenum++;
char buf[100];
sprintf(buf, "recoll://command/Page%d", pagenum);
return buf;
}
string RecollKioPager::prevUrl()
{
int pagenum = pageNumber();
if (pagenum <= 0)
pagenum = 0;
else
pagenum--;
char buf[100];
sprintf(buf, "recoll://command/Page%d", pagenum);
return buf;
}
static string welcomedata;
void RecollProtocol::welcomePage()
{
kDebug() << endl;
mimeType("text/html");
if (welcomedata.empty()) {
QString location =
KStandardDirs::locate("data", "kio_recoll/welcome.html");
string reason;
if (location.isEmpty() ||
!file_to_string((const char *)location.toUtf8(),
welcomedata, &reason)) {
welcomedata = "<html><head><title>Recoll Error</title></head>"
"<body><p>Could not locate Recoll welcome.html file: ";
welcomedata += reason;
welcomedata += "</p></body></html>";
}
}
string tmp;
map<char, string> subs;
subs['Q'] = "";
pcSubst(welcomedata, tmp, subs);
data(tmp.c_str());
kDebug() << "done" << endl;
}
void RecollProtocol::queryDetails()
{
kDebug() << endl;
mimeType("text/html");
QByteArray array;
QTextStream os(&array, QIODevice::WriteOnly);
os << "<html><head>" << endl;
os << "<meta http-equiv=\"Content-Type\" content=\"text/html;"
"charset=utf-8\">" << endl;
os << "<title>" << "Recoll query details" << "</title>\n" << endl;
os << "</head>" << endl;
os << "<body><h3>Query details:</h3>" << endl;
os << "<p>" << m_pager.queryDescription().c_str() <<"</p>"<< endl;
os << "<p><a href=\"recoll://command/Page" <<
m_pager.pageNumber() << "\">Return to results</a>" << endl;
os << "</body></html>" << endl;
data(array);
kDebug() << "done" << endl;
}
void RecollProtocol::htmlDoSearch(const QString& q, char opt)
{
kDebug() << endl;
mimeType("text/html");
doSearch(q, opt);
m_pager.setDocSource(m_source);
m_pager.resultPageNext();
m_pager.displayPage();
kDebug() << "done" << endl;
}
void RecollProtocol::outputError(const QString& errmsg)
{
mimeType("text/html");
QByteArray array;
QTextStream os(&array, QIODevice::WriteOnly);
os << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Strict//EN\">" << endl;
os << "<html><head>" << endl;
os << "<meta http-equiv=\"Content-Type\" content=\"text/html;"
"charset=utf-8\">" << endl;
os << "<title>" << "Recoll error" << "</title>\n" << endl;
os << "</head>" << endl;
os << "<body><p><b>Recoll error: </b>" << errmsg << "</p>" << endl;
os << "<p><a href=\"recoll:///\">New query</a></p>"<< endl;
os << "</body></html>" << endl;
data(array);
}

View File

@ -1,6 +1,22 @@
#ifndef lint
static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.15 2008-11-20 13:10:23 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.16 2008-11-26 15:03:41 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
@ -43,78 +59,24 @@ using namespace std;
using namespace KIO;
bool RecollKioPager::append(const string& data)
{
if (!m_parent) return false;
m_parent->data(QByteArray(data.c_str()));
return true;
}
string RecollKioPager::detailsLink()
{
string chunk = "<a href=\"recoll://command/QueryDetails\">";
chunk += tr("(show query)") + "</a>";
return chunk;
}
const static string parformat =
"<a href=\"%U\"><img src=\"%I\" align=\"left\"></a>"
"%R %S "
"<a href=\"%U\">Open</a>&nbsp;&nbsp;<b>%T</b><br>"
"%M&nbsp;%D&nbsp;&nbsp;&nbsp;<i>%U</i><br>"
"%A %K";
const string &RecollKioPager::parFormat()
{
return parformat;
}
string RecollKioPager::pageTop()
{
return "<p align=\"center\"><a href=\"recoll://welcome\">New Search</a></p>";
}
string RecollKioPager::nextUrl()
{
int pagenum = pageNumber();
if (pagenum < 0)
pagenum = 0;
else
pagenum++;
char buf[100];
sprintf(buf, "recoll://command/Page%d", pagenum);
return buf;
}
string RecollKioPager::prevUrl()
{
int pagenum = pageNumber();
if (pagenum <= 0)
pagenum = 0;
else
pagenum--;
char buf[100];
sprintf(buf, "recoll://command/Page%d", pagenum);
return buf;
}
static RclConfig *rclconfig;
RclConfig *RecollProtocol::o_rclconfig;
RclConfig *RclConfig::getMainConfig()
{
return rclconfig;
return RecollProtocol::o_rclconfig;
}
RecollProtocol::RecollProtocol(const QByteArray &pool, const QByteArray &app)
: SlaveBase("recoll", pool, app), m_initok(false),
m_rclconfig(0), m_rcldb(0)
: SlaveBase("recoll", pool, app), m_initok(false), m_rcldb(0)
{
m_pager.setParent(this);
string reason;
rclconfig = m_rclconfig = recollinit(0, 0, m_reason);
if (!m_rclconfig || !m_rclconfig->ok()) {
m_reason = string("Configuration problem: ") + reason;
return;
kDebug() << endl;
if (o_rclconfig == 0) {
o_rclconfig = recollinit(0, 0, m_reason);
if (!o_rclconfig || !o_rclconfig->ok()) {
m_reason = string("Configuration problem: ") + m_reason;
return;
}
}
m_dbdir = m_rclconfig->getDbDir();
if (m_dbdir.empty()) {
if (o_rclconfig->getDbDir().empty()) {
// Note: this will have to be replaced by a call to a
// configuration buildin dialog for initial configuration
m_reason = "No db directory in configuration ??";
@ -126,20 +88,17 @@ RecollProtocol::RecollProtocol(const QByteArray &pool, const QByteArray &app)
m_reason = "Could not build database object. (out of memory ?)";
return;
}
m_pager.setParent(this);
m_initok = true;
return;
}
// There should be an object counter somewhere to delete the config when done.
// Doesn't seem needed in the kio context.
RecollProtocol::~RecollProtocol()
{
kDebug() << endl;
delete m_rcldb;
delete m_rclconfig;
}
void RecollProtocol::mimetype(const KUrl & /*url*/)
{
mimeType("text/html");
finished();
}
bool RecollProtocol::maybeOpenDb(string &reason)
@ -148,43 +107,104 @@ bool RecollProtocol::maybeOpenDb(string &reason)
reason = "Internal error: initialization error";
return false;
}
if (!m_rcldb->isopen() && !m_rcldb->open(m_dbdir,
m_rclconfig->getStopfile(),
if (!m_rcldb->isopen() && !m_rcldb->open(o_rclconfig->getDbDir(),
o_rclconfig->getStopfile(),
Rcl::Db::DbRO)) {
reason = "Could not open database in " + m_dbdir;
reason = "Could not open database in " + o_rclconfig->getDbDir();
return false;
}
return true;
}
static string welcomedata;
void RecollProtocol::welcomePage()
void RecollProtocol::mimetype(const KUrl &url)
{
kDebug() << endl;
if (welcomedata.empty()) {
QString location =
KStandardDirs::locate("data", "kio_recoll/welcome.html");
string reason;
if (location.isEmpty() ||
!file_to_string((const char *)location.toUtf8(),
welcomedata, &reason)) {
welcomedata = "<html><head><title>Recoll Error</title></head>"
"<body><p>Could not locate Recoll welcome.html file: ";
welcomedata += reason;
welcomedata += "</p></body></html>";
kDebug() << url << endl;
if (0)
mimeType("text/html");
else
mimeType("inode/directory");
finished();
}
bool RecollProtocol::URLToQuery(const KUrl &url, QString& q, QString& opt)
{
if (url.host().isEmpty()) {
q = url.path();
opt = "l";
} else {
// Decode the forms' arguments
q = url.queryItem("q");
opt = url.queryItem("qtp");
if (opt.isEmpty()) {
opt = "l";
}
}
return true;
}
void RecollProtocol::get(const KUrl & url)
{
kDebug() << url << endl;
if (!m_initok || !maybeOpenDb(m_reason)) {
error(KIO::ERR_SLAVE_DEFINED, "Init error");
return;
}
error(KIO::ERR_IS_DIRECTORY, QString::null);
return;
QString host = url.host();
QString path = url.path();
kDebug() << "host:" << host << " path:" << path;
if (host.isEmpty() && !path.compare("/")) {
// recoll:/
welcomePage();
goto out;
} else if ((!host.compare("search") && !path.compare("/query"))
|| host.isEmpty()) {
// Either "recoll://search/query?query args"
// Or "recoll: some search string"
QString query, opt;
URLToQuery(url, query, opt);
if (!query.isEmpty()) {
htmlDoSearch(query, opt.toUtf8().at(0));
goto out;
}
}
string tmp;
map<char, string> subs;
subs['Q'] = "";
pcSubst(welcomedata, tmp, subs);
data(tmp.c_str());
kDebug() << "WelcomePage done" << endl;
} else if (!host.compare("command")) {
if (!path.isEmpty()) {
if (path.indexOf("/Page") == 0) {
int newpage = 0;
sscanf(path.toUtf8(), "/Page%d", &newpage);
if (newpage > m_pager.pageNumber()) {
int npages = newpage - m_pager.pageNumber();
for (int i = 0; i < npages; i++)
m_pager.resultPageNext();
} else if (newpage < m_pager.pageNumber()) {
int npages = m_pager.pageNumber() - newpage;
for (int i = 0; i < npages; i++)
m_pager.resultPageBack();
}
mimeType("text/html");
m_pager.displayPage();
goto out;
} else if (path.indexOf("/QueryDetails") == 0) {
queryDetails();
goto out;
}
}
}
kDebug() << "Unrecognized URL" << endl;
outputError("unrecognized URL");
out:
finished();
kDebug() << "done" << endl;
}
void RecollProtocol::doSearch(const QString& q, char opt)
{
kDebug() << q << endl;
string qs = (const char *)q.toUtf8();
Rcl::SearchData *sd = 0;
if (opt != 'l') {
@ -207,7 +227,7 @@ void RecollProtocol::doSearch(const QString& q, char opt)
if (sd && clp)
sd->addClause(clp);
} else {
kDebug() << "Parsing query";
kDebug() << "Parsing query: " << qs.c_str();
sd = wasaStringToRcl(qs, m_reason);
}
if (!sd) {
@ -219,6 +239,7 @@ void RecollProtocol::doSearch(const QString& q, char opt)
RefCntr<Rcl::SearchData> sdata(sd);
sdata->setStemlang("english");
kDebug() << "Building query";
RefCntr<Rcl::Query>query(new Rcl::Query(m_rcldb));
if (!query->setQuery(sdata)) {
m_reason = "Internal Error: setQuery failed";
@ -226,115 +247,19 @@ void RecollProtocol::doSearch(const QString& q, char opt)
finished();
return;
}
kDebug() << "Building docsequence";
DocSequenceDb *src =
new DocSequenceDb(RefCntr<Rcl::Query>(query), "Query results",
sdata);
m_pager.setDocSource(RefCntr<DocSequence>(src));
m_pager.resultPageNext();
}
void RecollProtocol::get(const KUrl & url)
{
kDebug() << url << endl;
mimeType("text/html");
if (!m_initok || !maybeOpenDb(m_reason)) {
outputError(m_reason.c_str());
new DocSequenceDb(RefCntr<Rcl::Query>(query), "Query results", sdata);
if (src == 0) {
kDebug() << "Cant' build result sequence";
error(-1, QString::null);
finished();
return;
}
QString host = url.host();
QString path = url.path();
kDebug() << "host:" << host << " path:" << path;
if (host.isEmpty() || !host.compare("welcome")) {
kDebug() << "Host is empty";
if (path.isEmpty() || !path.compare("/")) {
kDebug() << "Path is empty or strange";
// Display welcome page
welcomePage();
finished();
return;
}
// Ie: "recoll: some search string"
doSearch(path);
} else if (!host.compare("search")) {
if (path.compare("/query")) {
finished(); return;
}
// Decode the forms' arguments
QString query = url.queryItem("q");
if (query.isEmpty()) {
finished(); return;
}
QString opt = url.queryItem("qtp");
if (opt.isEmpty()) {
opt = "l";
}
doSearch(query, opt.toUtf8().at(0));
} else if (!host.compare("command")) {
if (path.isEmpty()) {
finished();return;
} else if (path.indexOf("/Page") == 0) {
int newpage = 0;
sscanf(path.toUtf8(), "/Page%d", &newpage);
if (newpage > m_pager.pageNumber()) {
int npages = newpage - m_pager.pageNumber();
for (int i = 0; i < npages; i++)
m_pager.resultPageNext();
} else if (newpage < m_pager.pageNumber()) {
int npages = m_pager.pageNumber() - newpage;
for (int i = 0; i < npages; i++)
m_pager.resultPageBack();
}
} else if (path.indexOf("/QueryDetails") == 0) {
QByteArray array;
QTextStream os(&array, QIODevice::WriteOnly);
os << "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" << endl;
os << "<title>" << "Recoll query details" << "</title>\n" << endl;
os << "</head>" << endl;
os << "<body><h3>Query details:</h3>" << endl;
os << "<p>" << m_pager.queryDescription().c_str() <<"</p>"<< endl;
os << "<p><a href=\"recoll://command/Page" <<
m_pager.pageNumber() << "\">Return to results</a>" << endl;
os << "</body></html>" << endl;
data(array);
finished();
return;
} else {
// Unknown //command/???
finished(); return;
}
} else {
// Unknown 'host' //??? value
finished(); return;
}
m_pager.displayPage();
kDebug() << "call finished" << endl;
finished();
kDebug() << "Setting source";
m_source = RefCntr<DocSequence>(src);
}
void RecollProtocol::outputError(const QString& errmsg)
{
QByteArray array;
QTextStream os(&array, QIODevice::WriteOnly);
os << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Strict//EN\">" << endl;
os << "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" << endl;
os << "<title>" << "Recoll output" << "</title>\n" << endl;
os << "</head>" << endl;
os << "<body><h1>Recoll Error</h1>" << errmsg << "</body>" << endl;
os << "</html>" << endl;
data(array);
}
// Note: KDE_EXPORT is actually needed on Unix when building with
// cmake. Says something like __attribute__(visibility(defautl))
// (cmake apparently sets all symbols to not exported)
@ -360,4 +285,3 @@ int kdemain(int argc, char **argv)
kDebug() << "kio_recoll Done" << endl;
return 0;
}

View File

@ -1,6 +1,22 @@
#ifndef _RECOLL_H
/* @(#$Id: kio_recoll.h,v 1.6 2008-11-20 13:10:23 dockes Exp $ (C) 2005 J.F.Dockes */
/* @(#$Id: kio_recoll.h,v 1.7 2008-11-26 15:03:41 dockes Exp $ (C) 2005 J.F.Dockes */
#define _RECOLL_H
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <string>
using std::string;
@ -17,7 +33,11 @@ using std::string;
#include <kio/global.h>
#include <kio/slavebase.h>
#include "rclconfig.h"
#include "rcldb.h"
#include "reslistpager.h"
#include "docseq.h"
#include "refcntr.h"
class RecollProtocol;
@ -42,20 +62,25 @@ class RecollProtocol : public KIO::SlaveBase {
virtual ~RecollProtocol();
virtual void mimetype(const KUrl & url );
virtual void get(const KUrl & url );
virtual void stat(const KUrl & url);
virtual void listDir(const KUrl& url);
static RclConfig *o_rclconfig;
private:
bool maybeOpenDb(string &reason);
void outputError(const QString& errmsg);
void doSearch(const QString& q, char opt = 'l');
void welcomePage();
void queryDetails();
void htmlDoSearch(const QString& q, char opt);
bool URLToQuery(const KUrl &url, QString& q, QString& opt);
bool m_initok;
RclConfig *m_rclconfig;
Rcl::Db *m_rcldb;
std::string m_dbdir;
std::string m_reason;
RecollKioPager m_pager;
RefCntr<DocSequence> m_source;
};
extern "C" {int kdemain(int, char**);}

View File

@ -0,0 +1,12 @@
- 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/
- 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

View File

@ -3,7 +3,9 @@ exec=kio_recoll
protocol=recoll
input=none
output=filesystem
listing=Name,Type, URL
reading=true
defaultMimeType=text/html
defaultMimeType=inode/directory
Icon=help_index
Class=:local
URIMode=rawuri