added support for openoffice and word + optimized decomp temp dir usage
This commit is contained in:
+16
-1
@@ -10,10 +10,13 @@
|
||||
#include "rclconfig.h"
|
||||
#include "pathut.h"
|
||||
#include "recoll.h"
|
||||
#include "smallut.h"
|
||||
#include "wipedir.h"
|
||||
|
||||
RclConfig *rclconfig;
|
||||
Rcl::Db *rcldb;
|
||||
int recollNeedsExit;
|
||||
string tmpdir;
|
||||
|
||||
|
||||
void recollCleanup()
|
||||
@@ -23,10 +26,15 @@ void recollCleanup()
|
||||
rcldb = 0;
|
||||
delete rclconfig;
|
||||
rclconfig = 0;
|
||||
if (tmpdir.length()) {
|
||||
wipedir(tmpdir);
|
||||
rmdir(tmpdir.c_str());
|
||||
tmpdir.erase();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void sigcleanup(int sig)
|
||||
static void sigcleanup(int)
|
||||
{
|
||||
fprintf(stderr, "sigcleanup\n");
|
||||
// Cant call exit from here, because the atexit cleanup does some
|
||||
@@ -71,6 +79,13 @@ int main( int argc, char ** argv )
|
||||
QString("No db directory in configuration"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!maketmpdir(tmpdir)) {
|
||||
QMessageBox::critical(0, "Recoll",
|
||||
QString("Cannot create temporary directory"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
dbdir = path_tildexpand(dbdir);
|
||||
|
||||
rcldb = new Rcl::Db;
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
#ifndef _RECOLL_H_INCLUDED_
|
||||
#define _RECOLL_H_INCLUDED_
|
||||
/* @(#$Id: recoll.h,v 1.1 2005-02-01 17:20:05 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
/* @(#$Id: recoll.h,v 1.2 2005-02-09 12:07:30 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
|
||||
#include "rclconfig.h"
|
||||
#include "rcldb.h"
|
||||
@@ -11,6 +11,7 @@ extern void recollCleanup();
|
||||
// Misc declarations in need of sharing between the UI files
|
||||
extern RclConfig *rclconfig;
|
||||
extern Rcl::Db *rcldb;
|
||||
extern string tmpdir;
|
||||
|
||||
extern int recollNeedsExit;
|
||||
|
||||
|
||||
+16
-24
@@ -95,33 +95,25 @@ static string plaintorich(const string &in, const list<string>& terms,
|
||||
myTextSplitCB cb(terms);
|
||||
TextSplit splitter(&cb, true);
|
||||
splitter.text_to_words(in);
|
||||
string out1;
|
||||
if (cb.tboffs.empty()) {
|
||||
out1 = in;
|
||||
} else {
|
||||
list<pair<int, int> >::iterator it = cb.tboffs.begin();
|
||||
for (unsigned int i = 0; i < in.length() ; i++) {
|
||||
if (it != cb.tboffs.end()) {
|
||||
if (i == (unsigned int)it->first) {
|
||||
out1 += "<termtag>";
|
||||
} else if (i == (unsigned int)it->second) {
|
||||
if (it != cb.tboffs.end())
|
||||
it++;
|
||||
out1 += "</termtag>";
|
||||
}
|
||||
}
|
||||
out1 += in[i];
|
||||
}
|
||||
}
|
||||
string out = "<qt><head><title></title></head><body><p>";
|
||||
for (string::const_iterator it = out1.begin();it != out1.end(); it++) {
|
||||
if (*it == '\n') {
|
||||
out += "<br>";
|
||||
// out += '\n';
|
||||
list<pair<int, int> >::iterator it = cb.tboffs.begin();
|
||||
for (unsigned int i = 0; i < in.length(); i++) {
|
||||
if (it != cb.tboffs.end()) {
|
||||
if (i == (unsigned int)it->first) {
|
||||
out += "<termtag>";
|
||||
} else if (i == (unsigned int)it->second) {
|
||||
if (it != cb.tboffs.end())
|
||||
it++;
|
||||
out += "</termtag>";
|
||||
}
|
||||
}
|
||||
if (in[i] == '\n') {
|
||||
out += "<br>\n";
|
||||
} else {
|
||||
out += *it;
|
||||
out += in[i];
|
||||
}
|
||||
}
|
||||
|
||||
termoffsets = cb.tboffs;
|
||||
return out;
|
||||
}
|
||||
@@ -208,7 +200,7 @@ void RecollMain::reslistTE_clicked(int par, int car)
|
||||
// for preview:
|
||||
string fn = urltolocalpath(doc.url);
|
||||
Rcl::Doc fdoc;
|
||||
if (!internfile(fn, rclconfig, fdoc)) {
|
||||
if (!internfile(fn, rclconfig, fdoc, tmpdir)) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
QString("Can't turn doc into internal rep ") +
|
||||
doc.mimetype.c_str());
|
||||
|
||||
Reference in New Issue
Block a user