From 9f00432fb70f4ead63ea90f0a278dc395ef64344 Mon Sep 17 00:00:00 2001 From: dockes Date: Wed, 6 Jan 2010 13:29:37 +0000 Subject: [PATCH] adapt kio and recollq to the new internfile interface --- src/kde/kioslave/recoll/htmlif.cpp | 22 +++++----------------- src/query/recollq.cpp | 20 ++++++++------------ src/query/xadump.cpp | 1 + 3 files changed, 14 insertions(+), 29 deletions(-) diff --git a/src/kde/kioslave/recoll/htmlif.cpp b/src/kde/kioslave/recoll/htmlif.cpp index af1e7b16..825a7517 100644 --- a/src/kde/kioslave/recoll/htmlif.cpp +++ b/src/kde/kioslave/recoll/htmlif.cpp @@ -231,30 +231,18 @@ public: const string &m_name; }; -void RecollProtocol::showPreview(const Rcl::Doc& doc) +void RecollProtocol::showPreview(const Rcl::Doc& idoc) { - string fn = doc.url.substr(7); - kDebug() << fn.c_str(); - - struct stat st; - if (::stat(fn.c_str(), &st) != 0) { - string reason = string("File not found: ") + fn.c_str(); - error(KIO::ERR_SLAVE_DEFINED, reason.c_str()); - return; - } string tmpdir; string reason; if (!maketmpdir(tmpdir, reason)) { error(KIO::ERR_SLAVE_DEFINED, "Cannot create temporary directory"); return; } - o_rclconfig->setKeyDir(path_getfather(fn)); - FileInterner interner(fn, &st, o_rclconfig, tmpdir, - FileInterner::FIF_forPreview | - FileInterner::FIF_doUseInputMimetype, - &doc.mimetype); + FileInterner interner(idoc, o_rclconfig, tmpdir, + FileInterner::FIF_forPreview); Rcl::Doc fdoc; - string ipath = doc.ipath; + string ipath = idoc.ipath; if (!interner.internfile(fdoc, ipath)) { wipedir(tmpdir); rmdir(tmpdir.c_str()); @@ -271,7 +259,7 @@ void RecollProtocol::showPreview(const Rcl::Doc& doc) mimeType("text/html"); - string fname = path_getsimple(doc.url).c_str(); + string fname = path_getsimple(fdoc.url).c_str(); PlainToRichKio ptr(fname); ptr.set_inputhtml(!fdoc.mimetype.compare("text/html")); list otextlist; diff --git a/src/query/recollq.cpp b/src/query/recollq.cpp index be461682..c3f46295 100644 --- a/src/query/recollq.cpp +++ b/src/query/recollq.cpp @@ -43,14 +43,8 @@ using namespace std; #include "wipedir.h" #include "transcode.h" -bool dump_contents(RclConfig *rclconfig, string& tmpdir, Rcl::Doc& doc) +bool dump_contents(RclConfig *rclconfig, string& tmpdir, Rcl::Doc& idoc) { - string fn = doc.url.substr(7); - struct stat st; - if (stat(fn.c_str(), &st) != 0) { - cout << "No such file: " << fn << endl; - return true; - } if (tmpdir.empty() || access(tmpdir.c_str(), 0) < 0) { string reason; if (!maketmpdir(tmpdir, reason)) { @@ -60,12 +54,14 @@ bool dump_contents(RclConfig *rclconfig, string& tmpdir, Rcl::Doc& doc) } } wipedir(tmpdir); - FileInterner interner(fn, &st, rclconfig, tmpdir, - FileInterner::FIF_forPreview, &doc.mimetype); - if (interner.internfile(doc, doc.ipath)) { - cout << doc.text << endl; + FileInterner interner(idoc, rclconfig, tmpdir, + FileInterner::FIF_forPreview); + Rcl::Doc fdoc; + string ipath = idoc.ipath; + if (interner.internfile(fdoc, ipath)) { + cout << fdoc.text << endl; } else { - cout << "Cant intern: " << fn << endl; + cout << "Cant turn to text:" << idoc.url << " | " << idoc.ipath << endl; } return true; } diff --git a/src/query/xadump.cpp b/src/query/xadump.cpp index 4299ea36..f50be15d 100644 --- a/src/query/xadump.cpp +++ b/src/query/xadump.cpp @@ -17,6 +17,7 @@ static char rcsid[] = "@(#$Id: xadump.cpp,v 1.20 2008-12-18 14:11:01 dockes Exp * Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include #include #include