diff --git a/src/bincimapmime/Makefile b/src/bincimapmime/Makefile index feb16708..8bbc56c5 100644 --- a/src/bincimapmime/Makefile +++ b/src/bincimapmime/Makefile @@ -1,7 +1,9 @@ include ../mk/sysconf LIBS = libmime.a -all: $(LIBS) +PROGS = trbinc + +all: $(LIBS) $(PROGS) SRCS = mime-getpart.cc mime-parsefull.cc mime-parseonlyheader.cc \ mime-printbody.cc mime-printdoc.cc mime-printheader.cc mime.cc \ @@ -18,6 +20,9 @@ libmime.a : $(OBJS) .cc .o : $(CXX) $(CXXFLAGS) -c $< +TRBINCOBJS = trbinc.o +trbinc: trbinc.o + $(CXX) -o trbinc trbinc.o libmime.a clean: rm -f *.o $(LIBS) diff --git a/src/bincimapmime/iodevice.cc b/src/bincimapmime/iodevice.cc index df3b8400..0cda86f2 100644 --- a/src/bincimapmime/iodevice.cc +++ b/src/bincimapmime/iodevice.cc @@ -25,7 +25,7 @@ */ #include "iodevice.h" #include "convert.h" // BincStream -#include "session.h" // getEnv/hasEnv +//#include "session.h" // getEnv/hasEnv #include #include @@ -306,6 +306,7 @@ unsigned int IODevice::getWriteCount(void) const //------------------------------------------------------------------------ void IODevice::enableProtocolDumping(void) { +#if 0 BincStream ss; ss << "/tmp/bincimap-dump-" << (int) time(0) << "-" << Session::getInstance().getIP() << "-XXXXXX"; @@ -314,4 +315,5 @@ void IODevice::enableProtocolDumping(void) if (dumpfd == -1) dumpfd = 0; delete safename; +#endif } diff --git a/src/index/indexer.cpp b/src/index/indexer.cpp index e6aae060..e49b90da 100644 --- a/src/index/indexer.cpp +++ b/src/index/indexer.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: indexer.cpp,v 1.6 2005-02-10 15:21:12 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: indexer.cpp,v 1.7 2005-03-17 14:02:05 dockes Exp $ (C) 2004 J.F.Dockes"; #endif #include #include @@ -139,7 +139,7 @@ DbIndexer::processone(const std::string &fn, const struct stat *stp, // Set up common fields: char ascdate[20]; - sprintf(ascdate, "%ld", long(stp->st_mtime)); + sprintf(ascdate, "%ld", long(stp->st_ctime)); doc.mtime = ascdate; // Do database-specific work to update document data diff --git a/src/qtgui/recollmain.ui.h b/src/qtgui/recollmain.ui.h index 11c58477..547a3e41 100644 --- a/src/qtgui/recollmain.ui.h +++ b/src/qtgui/recollmain.ui.h @@ -31,6 +31,7 @@ using std::pair; #include "internfile.h" #include "textsplit.h" #include "smallut.h" +#include "utf8iter.h" #ifndef MIN #define MIN(A,B) ((A) < (B) ? (A) : (B)) @@ -49,7 +50,7 @@ void RecollMain::checkExit() if (indexingstatus) { indexingstatus = false; // Make sure we reopen the db to get the results. - fprintf(stderr, "Indexing done: closing query database\n"); + LOGINFO(("Indexing done: closing query database\n")); rcldb->close(); } if (recollNeedsExit) @@ -91,6 +92,7 @@ static string plaintorich(const string &in, const list& terms, myTextSplitCB cb(terms); TextSplit splitter(&cb, true); splitter.text_to_words(in); + bool ateol = false; string out = "

"; list >::iterator it = cb.tboffs.begin(); for (unsigned int i = 0; i < in.length(); i++) { @@ -104,8 +106,11 @@ static string plaintorich(const string &in, const list& terms, } } if (in[i] == '\n') { - out += "
\n"; + if (!ateol) + out += "
"; + ateol = true; } else { + ateol = false; out += in[i]; } } @@ -149,9 +154,9 @@ void RecollMain::reslistTE_doubleClicked(int par, int) if (*it1 == '%') ncmd += '%'; if (*it1 == 'u') - ncmd += doc.url; + ncmd += "'" + doc.url + "'"; if (*it1 == 'f') - ncmd += fn; + ncmd += "'" + fn + "'"; } else { ncmd += *it1; } @@ -170,10 +175,6 @@ void RecollMain::reslistTE_clicked(int par, int car) if (reslist_winfirst == -1) return; - // If same doc, don't bother redisplaying - if (reslist_current == par - 1) - return; - Rcl::Doc doc; if (reslist_current != -1) { QColor color("white"); @@ -217,13 +218,23 @@ void RecollMain::reslistTE_clicked(int par, int car) int para = 0, index = 1; if (!termoffsets.empty()) { index = (termoffsets.begin())->first; - LOGDEB1(("Setting cursor position to para %d, index %d\n",para,index)); + LOGDEB(("Byte index: %d\n", index)); + // Translate byte to character offset + string::size_type pos = 0; + Utf8Iter it(rich); + for (; pos != string::npos && (int)pos < index; it++) { + pos = it.getBpos(); + } + index = pos == string::npos ? 0 : it.getCpos(); + LOGDEB(("Setting cursor position to para %d, charindex %d\n", + para,index)); previewTextEdit->setCursorPosition(0, index); } previewTextEdit->ensureCursorVisible(); previewTextEdit->getCursorPosition(¶, &index); - LOGDEB1(("PREVIEW Paragraphs: %d. Cpos: %d %d\n", - previewTextEdit->paragraphs(), para, index)); + LOGDEB(("PREVIEW len %d paragraphs: %d. Cpos: %d %d\n", + previewTextEdit->length(), previewTextEdit->paragraphs(), + para, index)); } diff --git a/src/sampleconf/mimeconf b/src/sampleconf/mimeconf index 0280da51..157c65ad 100644 --- a/src/sampleconf/mimeconf +++ b/src/sampleconf/mimeconf @@ -1,4 +1,4 @@ -# @(#$Id: mimeconf,v 1.3 2005-02-09 12:07:30 dockes Exp $ (C) 2004 J.F.Dockes +# @(#$Id: mimeconf,v 1.4 2005-03-17 14:02:05 dockes Exp $ (C) 2004 J.F.Dockes # Recoll : associations of mime types to processing filters. # There are different sections for decompression, 'interning' for indexing @@ -49,8 +49,7 @@ text/plain = xemacs %f text/html = firefox -a firefox -remote "openFile(%u)" application/pdf = xpdf %f application/postscript = gv %f -application/msword = openoffice-1.1.3-swriter - +application/msword = openoffice-1.1.3-swriter %f application/vnd.sun.xml.calc = openoffice-1.1.3 %f application/vnd.sun.xml.calc.template = openoffice-1.1.3 %f application/vnd.sun.xml.draw = openoffice-1.1.3 %f diff --git a/src/utils/execmd.cpp b/src/utils/execmd.cpp index 91b3bac1..9cefa6e7 100644 --- a/src/utils/execmd.cpp +++ b/src/utils/execmd.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: execmd.cpp,v 1.5 2005-02-10 15:21:12 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: execmd.cpp,v 1.6 2005-03-17 14:02:05 dockes Exp $ (C) 2004 J.F.Dockes"; #endif #ifndef TEST_EXECMD #include @@ -22,7 +22,7 @@ using namespace std; #define MAX(A,B) (A>B?A:B) int -ExecCmd::doexec(const string &cmd, const list args, +ExecCmd::doexec(const string &cmd, const list& args, const string *input, string *output) { { diff --git a/src/utils/execmd.h b/src/utils/execmd.h index 48572417..4ce19f6a 100644 --- a/src/utils/execmd.h +++ b/src/utils/execmd.h @@ -1,6 +1,6 @@ #ifndef _EXECMD_H_INCLUDED_ #define _EXECMD_H_INCLUDED_ -/* @(#$Id: execmd.h,v 1.1 2004-12-12 08:58:12 dockes Exp $ (C) 2004 J.F.Dockes */ +/* @(#$Id: execmd.h,v 1.2 2005-03-17 14:02:06 dockes Exp $ (C) 2004 J.F.Dockes */ #include #include @@ -9,7 +9,7 @@ class ExecCmd { public: // ExecCmd() : argv(0) {}; // ~ExeCmd() {delete [] argv;} - int doexec(const std::string &cmd, const std::list a, + int doexec(const std::string &cmd, const std::list& a, const std::string *input = 0, std::string *output = 0); }; diff --git a/src/utils/mimeparse.cpp b/src/utils/mimeparse.cpp index 57f51c1c..31a46cd6 100644 --- a/src/utils/mimeparse.cpp +++ b/src/utils/mimeparse.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: mimeparse.cpp,v 1.1 2005-01-26 11:45:55 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: mimeparse.cpp,v 1.2 2005-03-17 14:02:06 dockes Exp $ (C) 2004 J.F.Dockes"; #endif #ifndef TEST_MIMEPARSE @@ -36,7 +36,7 @@ MimeHeaderValue parseMimeHeaderValue(const string &ein) { string in = ein; MimeHeaderValue out; - string::size_type pos, pos1; + string::size_type pos; pos = in.find_first_not_of(WHITE); if (pos == string::npos) diff --git a/src/utils/smallut.cpp b/src/utils/smallut.cpp index 46ce6eed..c5a6492e 100644 --- a/src/utils/smallut.cpp +++ b/src/utils/smallut.cpp @@ -1,10 +1,12 @@ #ifndef lint -static char rcsid[] = "@(#$Id: smallut.cpp,v 1.4 2005-02-10 15:21:12 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: smallut.cpp,v 1.5 2005-03-17 14:02:06 dockes Exp $ (C) 2004 J.F.Dockes"; #endif #ifndef TEST_SMALLUT #include #include #include +#include + #include #include @@ -12,6 +14,8 @@ static char rcsid[] = "@(#$Id: smallut.cpp,v 1.4 2005-02-10 15:21:12 dockes Exp #include "debuglog.h" #include "pathut.h" +using namespace std; + #define MIN(A,B) ((A)<(B)?(A):(B)) bool maketmpdir(string& tdir) diff --git a/src/utils/smallut.h b/src/utils/smallut.h index f12d637b..e1a97e49 100644 --- a/src/utils/smallut.h +++ b/src/utils/smallut.h @@ -1,11 +1,12 @@ #ifndef _SMALLUT_H_INCLUDED_ #define _SMALLUT_H_INCLUDED_ -/* @(#$Id: smallut.h,v 1.4 2005-02-10 15:21:12 dockes Exp $ (C) 2004 J.F.Dockes */ +/* @(#$Id: smallut.h,v 1.5 2005-03-17 14:02:06 dockes Exp $ (C) 2004 J.F.Dockes */ #include #include +#include using std::string; using std::list; - +using std::ostream; extern int stringicmp(const string& s1, const string& s2); extern int stringlowercmp(const string& alreadylower, const string& s2); extern int stringuppercmp(const string& alreadyupper, const string& s2); diff --git a/src/utils/utf8iter.h b/src/utils/utf8iter.h index c4008e7d..17305306 100644 --- a/src/utils/utf8iter.h +++ b/src/utils/utf8iter.h @@ -1,6 +1,6 @@ #ifndef _UTF8ITER_H_INCLUDED_ #define _UTF8ITER_H_INCLUDED_ -/* @(#$Id: utf8iter.h,v 1.2 2005-02-11 11:20:02 dockes Exp $ (C) 2004 J.F.Dockes */ +/* @(#$Id: utf8iter.h,v 1.3 2005-03-17 14:02:06 dockes Exp $ (C) 2004 J.F.Dockes */ /** * A small helper class to iterate over utf8 strings. This is not an @@ -117,9 +117,10 @@ class Utf8Iter { return (unsigned int)-1; } + /** Set current position before next utf-8 character */ string::size_type operator++(int) { if (bad || (!cl && compute_cl() < 0)) { - return string::npos; + return pos = string::npos; } pos += cl; m_charpos++;