internfile: do not compute md5 when in preview mode

This commit is contained in:
"Jean-Francois Dockes ext:(%22) 2013-04-09 12:40:46 +02:00
parent 321978bfea
commit 860521be88
7 changed files with 72 additions and 47 deletions

View File

@ -2089,9 +2089,18 @@ fvwm
skeleton style sheet (<filename>recoll.qss</filename>)
inside the <filename>/usr/share/recoll/examples</filename>
directory. Using a style sheet, you can change most
<command>recoll</command> graphical parameters: colors,
fonts, etc. See the sample file for a few simple
examples.</para>
<command>recoll</command> graphical parameters:
colors, fonts, etc. See the sample file for a few
simple examples.</para>
<para>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.</para>
</listitem>
<listitem><para><guilabel>Maximum text size highlighted for

View File

@ -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]);

View File

@ -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);

View File

@ -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;
}

View File

@ -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."

View File

@ -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;
}

View File

@ -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.</p>
restrictions due to the Qt QTextBrowser object. The details
are described in the
<a href="http://www.recoll.org/usermanual/rcl.search.html#RCL.SEARCH.GUI.CUSTOM.RESLIST">
Recoll manual</a>.</p>
<p>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.</p>
<p>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.</p>
<h2>New in Recoll 1.17: the WebKit result list</h2>