get things to compile with recoll 1.9 and suse + kde 3.5.5

This commit is contained in:
dockes 2007-11-09 15:46:17 +00:00
parent 5fdea601f3
commit 8f082be8d5
3 changed files with 30 additions and 15 deletions

View File

@ -1,4 +1,6 @@
(this used to work but last time I tried with konqueror (kde3, 11-2007), it failed with "protocol not authorized" or such. Didn't investigate more).
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 A kio_slave was implemented, supporting the "get" operation. Ie, you type

View File

@ -1,11 +1,13 @@
depth=../.. depth=../../..
include $(depth)/mk/sysconf include $(depth)/mk/sysconf
all: kio_recoll.so all: kio_recoll.so
DEPS_CXXFLAGS = -MT pop3.lo -MD -MP -MF .deps/pop3.Tpo DEPS_CXXFLAGS = -MT pop3.lo -MD -MP -MF .deps/pop3.Tpo
INC_CXXFLAGS = -I. -I/usr/local/include -I/usr/X11R6/include \ INC_CXXFLAGS = -I. \
-I/usr/local/include -I/usr/X11R6/include \
-I/opt/kde3/include -I$(QTDIR)/include \
-I$(depth)/common -I$(depth)/query -I$(depth)/utils \ -I$(depth)/common -I$(depth)/query -I$(depth)/utils \
-I$(depth)/qtgui -I$(depth)/rcldb -I$(depth)/qtgui -I$(depth)/rcldb
@ -17,7 +19,10 @@ QT_CXXFLAGS = -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL \
SYS_CXXFLAGS = -D_GNU_SOURCE SYS_CXXFLAGS = -D_GNU_SOURCE
THREAD_CXXFLAGS = -D_THREAD_SAFE -pthread -D_THREAD_SAFE -pthread THREAD_CXXFLAGS = -D_THREAD_SAFE -pthread -D_THREAD_SAFE -pthread
LDFLAGS = -rpath=/usr/lib:/usr/local/lib \
# -rpath=/usr/lib:/usr/local/lib \
LDFLAGS = \
-Wl,--rpath -Wl,/usr/local/lib \ -Wl,--rpath -Wl,/usr/local/lib \
-Wl,--rpath -Wl,/usr/X11R6/lib \ -Wl,--rpath -Wl,/usr/X11R6/lib \
-Wl,-export-dynamic -Wl,-soname -Wl,kio_recoll.so -Wl,-export-dynamic -Wl,-soname -Wl,kio_recoll.so
@ -28,8 +33,8 @@ kio_recoll.so : kio_recoll.o libpic
-Wl,--no-undefined \ -Wl,--no-undefined \
kio_recoll.o piclib/librcl.a \ kio_recoll.o piclib/librcl.a \
$(LIBXAPIAN) $(LIBICONV) \ $(LIBXAPIAN) $(LIBICONV) \
-L/usr/local/lib -L/usr/X11R6/lib -lkio -lkdecore \ -L/opt/kde3/lib -L/usr/local/lib -L/usr/X11R6/lib -lkio -lkdecore \
-lqt-mt \ -L/usr/lib/qt3/lib -lqt-mt \
-L/usr/lib -lstdc++ -lm -lc \ -L/usr/lib -lstdc++ -lm -lc \
-o kio_recoll.so -o kio_recoll.so

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.6 2007-02-01 12:43:21 dockes Exp $ (C) 2005 J.F.Dockes"; static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.7 2007-11-09 15:46:17 dockes Exp $ (C) 2005 J.F.Dockes";
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -27,14 +27,18 @@ using namespace std;
#include "kio_recoll.h" #include "kio_recoll.h"
using namespace KIO; using namespace KIO;
static RclConfig *rclconfig;
RclConfig *RclConfig::getMainConfig()
{
return rclconfig;
}
RecollProtocol::RecollProtocol(const QCString &pool, const QCString &app) RecollProtocol::RecollProtocol(const QCString &pool, const QCString &app)
: SlaveBase("recoll", pool, app), m_initok(false), : SlaveBase("recoll", pool, app), m_initok(false),
m_rclconfig(0), m_rcldb(0), m_docsource(0) m_rclconfig(0), m_rcldb(0), m_docsource(0)
{ {
string reason; string reason;
m_rclconfig = recollinit(0, 0, m_reason); rclconfig = m_rclconfig = recollinit(0, 0, m_reason);
if (!m_rclconfig || !m_rclconfig->ok()) { if (!m_rclconfig || !m_rclconfig->ok()) {
m_reason = string("Configuration problem: ") + reason; m_reason = string("Configuration problem: ") + reason;
return; return;
@ -69,7 +73,10 @@ bool RecollProtocol::maybeOpenDb(string &reason)
reason = "Internal error: initialization error"; reason = "Internal error: initialization error";
return false; return false;
} }
if (!m_rcldb->isopen() && !m_rcldb->open(m_dbdir, Rcl::Db::DbRO)) { if (!m_rcldb->isopen() && !m_rcldb->open(m_dbdir,
m_rclconfig->getStopfile(),
Rcl::Db::DbRO,
Rcl::Db::QO_STEM)) {
reason = "Could not open database in " + m_dbdir; reason = "Could not open database in " + m_dbdir;
return false; return false;
} }
@ -134,7 +141,7 @@ void RecollProtocol::get(const KURL & url)
if (!m_docsource->getDoc(i, doc, &percent, &sh)) { if (!m_docsource->getDoc(i, doc, &percent, &sh)) {
// This may very well happen for history if the doc has // This may very well happen for history if the doc has
// been removed since. So don't treat it as fatal. // been removed since. So don't treat it as fatal.
doc.abstract = string("Unavailable document"); doc.meta["abstract"] = string("Unavailable document");
} }
string iconname = m_rclconfig->getMimeIconName(doc.mimetype); string iconname = m_rclconfig->getMimeIconName(doc.mimetype);
@ -150,8 +157,8 @@ void RecollProtocol::get(const KURL & url)
char perbuf[10]; char perbuf[10];
sprintf(perbuf, "%3d%%", percent); sprintf(perbuf, "%3d%%", percent);
if (doc.title.empty()) if (doc.meta["title"].empty())
doc.title = path_getsimple(doc.url); doc.meta["title"] = path_getsimple(doc.url);
char datebuf[100]; char datebuf[100];
datebuf[0] = 0; datebuf[0] = 0;
if (!doc.dmtime.empty() || !doc.fmtime.empty()) { if (!doc.dmtime.empty() || !doc.fmtime.empty()) {
@ -162,12 +169,13 @@ void RecollProtocol::get(const KURL & url)
"<i>Modified:</i>&nbsp;%Y-%m-%d&nbsp;%H:%M:%S", tm); "<i>Modified:</i>&nbsp;%Y-%m-%d&nbsp;%H:%M:%S", tm);
} }
result += "<img src=\"file://" + imgfile + "\" align=\"left\">"; result += "<img src=\"file://" + imgfile + "\" align=\"left\">";
string abst = escapeHtml(doc.abstract); string abst = escapeHtml(doc.meta["abstract"]);
result += string(perbuf) + " <b>" + doc.title + "</b><br>" + result += string(perbuf) + " <b>" + doc.meta["title"] + "</b><br>" +
doc.mimetype + "&nbsp;" + doc.mimetype + "&nbsp;" +
(datebuf[0] ? string(datebuf) + "<br>" : string("<br>")) + (datebuf[0] ? string(datebuf) + "<br>" : string("<br>")) +
(!abst.empty() ? abst + "<br>" : string("")) + (!abst.empty() ? abst + "<br>" : string("")) +
(!doc.keywords.empty() ? doc.keywords + "<br>" : string("")) + (!doc.meta["keywords"].empty() ? doc.meta["keywords"] +
"<br>" : string("")) +
"<a href=\"" + doc.url + "\">" + doc.url + "</a><br></p>\n"; "<a href=\"" + doc.url + "\">" + doc.url + "</a><br></p>\n";
QString str = QString::fromUtf8(result.c_str(), result.length()); QString str = QString::fromUtf8(result.c_str(), result.length());