adapt kio and recollq to the new internfile interface
This commit is contained in:
parent
8bc35e8e96
commit
9f00432fb7
@ -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<string> otextlist;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <strings.h>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user