From 860521be8823dde2f3a5a16f4e2f7ca1cd663f28 Mon Sep 17 00:00:00 2001
From: "\"Jean-Francois Dockes ext:(%22)"
Date: Tue, 9 Apr 2013 12:40:46 +0200
Subject: [PATCH] internfile: do not compute md5 when in preview mode
---
src/doc/user/usermanual.sgml | 15 ++++++++++++---
src/internfile/mh_exec.cpp | 14 ++++++++------
src/internfile/mh_execm.cpp | 24 ++++++++++++++----------
src/internfile/mh_html.cpp | 11 ++++++-----
src/internfile/mh_mail.cpp | 27 +++++++++++++++------------
src/internfile/mh_text.cpp | 17 ++++++++++-------
website/custom.html | 11 +++++++----
7 files changed, 72 insertions(+), 47 deletions(-)
diff --git a/src/doc/user/usermanual.sgml b/src/doc/user/usermanual.sgml
index 5537af54..861d2300 100644
--- a/src/doc/user/usermanual.sgml
+++ b/src/doc/user/usermanual.sgml
@@ -2089,9 +2089,18 @@ fvwm
skeleton style sheet (recoll.qss)
inside the /usr/share/recoll/examples
directory. Using a style sheet, you can change most
- recoll graphical parameters: colors,
- fonts, etc. See the sample file for a few simple
- examples.
+ recoll graphical parameters:
+ colors, fonts, etc. See the sample file for a few
+ simple examples.
+ You should be aware that parameters (e.g.: the
+ background color) set inside the &RCL; GUI style sheet
+ will override global system preferences, with possible
+ strange side effects: for example if you set the
+ foreground to a light color and the background to a
+ dark one in the desktop preferences, but only the
+ background is set inside the &RCL; style sheet, and it
+ is light too, then text will appear light-on-light
+ inside the &RCL; GUI.
Maximum text size highlighted for
diff --git a/src/internfile/mh_exec.cpp b/src/internfile/mh_exec.cpp
index 2b0fc03b..fd271fa4 100644
--- a/src/internfile/mh_exec.cpp
+++ b/src/internfile/mh_exec.cpp
@@ -175,12 +175,14 @@ void MimeHandlerExec::finaldetails()
m_metaData[cstr_dj_keymt] = cfgFilterOutputMtype.empty() ? "text/html" :
cfgFilterOutputMtype;
- string md5, xmd5, reason;
- if (MD5File(m_fn, md5, &reason)) {
- m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
- } else {
- LOGERR(("MimeHandlerExec: cant compute md5 for [%s]: %s\n",
- m_fn.c_str(), reason.c_str()));
+ if (!m_forPreview) {
+ string md5, xmd5, reason;
+ if (MD5File(m_fn, md5, &reason)) {
+ m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
+ } else {
+ LOGERR(("MimeHandlerExec: cant compute md5 for [%s]: %s\n",
+ m_fn.c_str(), reason.c_str()));
+ }
}
handle_cs(m_metaData[cstr_dj_keymt]);
diff --git a/src/internfile/mh_execm.cpp b/src/internfile/mh_execm.cpp
index befd7c34..f9934527 100644
--- a/src/internfile/mh_execm.cpp
+++ b/src/internfile/mh_execm.cpp
@@ -278,19 +278,23 @@ bool MimeHandlerExecMultiple::next_document()
}
}
m_metaData[cstr_dj_keymt] = mtype;
- string md5, xmd5;
- MD5String(m_metaData[cstr_dj_keycontent], md5);
- m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
+ if (!m_forPreview) {
+ string md5, xmd5;
+ MD5String(m_metaData[cstr_dj_keycontent], md5);
+ m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
+ }
} else {
m_metaData[cstr_dj_keymt] = mtype.empty() ? "text/html" : mtype;
m_metaData.erase(cstr_dj_keyipath);
- string md5, xmd5, reason;
- if (MD5File(m_fn, md5, &reason)) {
- m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
- } else {
- LOGERR(("MimeHandlerExecM: cant compute md5 for [%s]: %s\n",
- m_fn.c_str(), reason.c_str()));
- }
+ if (!m_forPreview) {
+ string md5, xmd5, reason;
+ if (MD5File(m_fn, md5, &reason)) {
+ m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
+ } else {
+ LOGERR(("MimeHandlerExecM: cant compute md5 for [%s]: %s\n",
+ m_fn.c_str(), reason.c_str()));
+ }
+ }
}
handle_cs(m_metaData[cstr_dj_keymt], charset);
diff --git a/src/internfile/mh_html.cpp b/src/internfile/mh_html.cpp
index 5a9de050..3ee209d6 100644
--- a/src/internfile/mh_html.cpp
+++ b/src/internfile/mh_html.cpp
@@ -52,11 +52,12 @@ bool MimeHandlerHtml::set_document_string(const string& htext)
m_html = htext;
m_havedoc = true;
- // We want to compute the md5 now because we may modify m_html later
- string md5, xmd5;
- MD5String(htext, md5);
- m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
-
+ if (!m_forPreview) {
+ // We want to compute the md5 now because we may modify m_html later
+ string md5, xmd5;
+ MD5String(htext, md5);
+ m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
+ }
return true;
}
diff --git a/src/internfile/mh_mail.cpp b/src/internfile/mh_mail.cpp
index 6f963ec2..14512fff 100644
--- a/src/internfile/mh_mail.cpp
+++ b/src/internfile/mh_mail.cpp
@@ -94,16 +94,17 @@ bool MimeHandlerMail::set_document_file(const string &fn)
m_fd = -1;
}
- // Yes, we read the file twice. It would be possible in theory to add
- // the md5 computation to the mime analysis, but ...
- string md5, xmd5, reason;
- if (MD5File(fn, md5, &reason)) {
- m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
- } else {
- LOGERR(("MimeHandlerMail: cant compute md5 for [%s]: %s\n", fn.c_str(),
- reason.c_str()));
+ if (!m_forPreview) {
+ // Yes, we read the file twice. It would be possible in theory
+ // to add the md5 computation to the mime analysis, but ...
+ string md5, xmd5, reason;
+ if (MD5File(fn, md5, &reason)) {
+ m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
+ } else {
+ LOGERR(("MimeHandlerMail: cant md5 [%s]: %s\n", fn.c_str(),
+ reason.c_str()));
+ }
}
-
m_fd = open(fn.c_str(), 0);
if (m_fd < 0) {
LOGERR(("MimeHandlerMail::set_document_file: open(%s) errno %d\n",
@@ -128,9 +129,11 @@ bool MimeHandlerMail::set_document_string(const string &msgtxt)
LOGDEB2(("Message text: [%s]\n", msgtxt.c_str()));
delete m_stream;
- string md5, xmd5;
- MD5String(msgtxt, md5);
- m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
+ if (!m_forPreview) {
+ string md5, xmd5;
+ MD5String(msgtxt, md5);
+ m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
+ }
if ((m_stream = new stringstream(msgtxt)) == 0 || !m_stream->good()) {
LOGERR(("MimeHandlerMail::set_document_string: stream create error."
diff --git a/src/internfile/mh_text.cpp b/src/internfile/mh_text.cpp
index 5f5fd023..04e7a832 100644
--- a/src/internfile/mh_text.cpp
+++ b/src/internfile/mh_text.cpp
@@ -82,10 +82,11 @@ bool MimeHandlerText::set_document_file(const string &fn)
LOGDEB(("file_to_string OK\n"));
m_offs = m_text.length();
}
-
- string md5, xmd5;
- MD5String(m_text, md5);
- m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
+ if (!m_forPreview) {
+ string md5, xmd5;
+ MD5String(m_text, md5);
+ m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
+ }
m_havedoc = true;
return true;
}
@@ -93,9 +94,11 @@ bool MimeHandlerText::set_document_file(const string &fn)
bool MimeHandlerText::set_document_string(const string& otext)
{
m_text = otext;
- string md5, xmd5;
- MD5String(m_text, md5);
- m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
+ if (!m_forPreview) {
+ string md5, xmd5;
+ MD5String(m_text, md5);
+ m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
+ }
m_havedoc = true;
return true;
}
diff --git a/website/custom.html b/website/custom.html
index 1b73bd2d..8e1135ca 100644
--- a/website/custom.html
+++ b/website/custom.html
@@ -86,11 +86,14 @@ a:hover .PZ3cap { padding:3px 5px; }
can specify the format for the list entries: what data is
displayed for each hit document and how. This used to include
"almost full" support for HTML capabilities, with a few
- restrictions due to the Qt QTextBrowser object.
+ restrictions due to the Qt QTextBrowser object. The details
+ are described in the
+
+ Recoll manual.
- As of Recoll 1.17, the result list is by default a WebKit
- object (WebKit is the basis for several major browsers), which
- yields full CSS and even Javascript support.
+ As of Recoll 1.17, the result list is a WebKit object by
+ default (WebKit is the basis for several major browsers),
+ which yields full CSS and even Javascript support.
New in Recoll 1.17: the WebKit result list