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>) skeleton style sheet (<filename>recoll.qss</filename>)
inside the <filename>/usr/share/recoll/examples</filename> inside the <filename>/usr/share/recoll/examples</filename>
directory. Using a style sheet, you can change most directory. Using a style sheet, you can change most
<command>recoll</command> graphical parameters: colors, <command>recoll</command> graphical parameters:
fonts, etc. See the sample file for a few simple colors, fonts, etc. See the sample file for a few
examples.</para> 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>
<listitem><para><guilabel>Maximum text size highlighted for <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" : m_metaData[cstr_dj_keymt] = cfgFilterOutputMtype.empty() ? "text/html" :
cfgFilterOutputMtype; cfgFilterOutputMtype;
string md5, xmd5, reason; if (!m_forPreview) {
if (MD5File(m_fn, md5, &reason)) { string md5, xmd5, reason;
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5); if (MD5File(m_fn, md5, &reason)) {
} else { m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
LOGERR(("MimeHandlerExec: cant compute md5 for [%s]: %s\n", } else {
m_fn.c_str(), reason.c_str())); LOGERR(("MimeHandlerExec: cant compute md5 for [%s]: %s\n",
m_fn.c_str(), reason.c_str()));
}
} }
handle_cs(m_metaData[cstr_dj_keymt]); handle_cs(m_metaData[cstr_dj_keymt]);

View File

@ -278,19 +278,23 @@ bool MimeHandlerExecMultiple::next_document()
} }
} }
m_metaData[cstr_dj_keymt] = mtype; m_metaData[cstr_dj_keymt] = mtype;
string md5, xmd5; if (!m_forPreview) {
MD5String(m_metaData[cstr_dj_keycontent], md5); string md5, xmd5;
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5); MD5String(m_metaData[cstr_dj_keycontent], md5);
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
}
} else { } else {
m_metaData[cstr_dj_keymt] = mtype.empty() ? "text/html" : mtype; m_metaData[cstr_dj_keymt] = mtype.empty() ? "text/html" : mtype;
m_metaData.erase(cstr_dj_keyipath); m_metaData.erase(cstr_dj_keyipath);
string md5, xmd5, reason; if (!m_forPreview) {
if (MD5File(m_fn, md5, &reason)) { string md5, xmd5, reason;
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5); if (MD5File(m_fn, md5, &reason)) {
} else { m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
LOGERR(("MimeHandlerExecM: cant compute md5 for [%s]: %s\n", } else {
m_fn.c_str(), reason.c_str())); LOGERR(("MimeHandlerExecM: cant compute md5 for [%s]: %s\n",
} m_fn.c_str(), reason.c_str()));
}
}
} }
handle_cs(m_metaData[cstr_dj_keymt], charset); 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_html = htext;
m_havedoc = true; m_havedoc = true;
// We want to compute the md5 now because we may modify m_html later if (!m_forPreview) {
string md5, xmd5; // We want to compute the md5 now because we may modify m_html later
MD5String(htext, md5); string md5, xmd5;
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5); MD5String(htext, md5);
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
}
return true; return true;
} }

View File

@ -94,16 +94,17 @@ bool MimeHandlerMail::set_document_file(const string &fn)
m_fd = -1; m_fd = -1;
} }
// Yes, we read the file twice. It would be possible in theory to add if (!m_forPreview) {
// the md5 computation to the mime analysis, but ... // Yes, we read the file twice. It would be possible in theory
string md5, xmd5, reason; // to add the md5 computation to the mime analysis, but ...
if (MD5File(fn, md5, &reason)) { string md5, xmd5, reason;
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5); if (MD5File(fn, md5, &reason)) {
} else { m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
LOGERR(("MimeHandlerMail: cant compute md5 for [%s]: %s\n", fn.c_str(), } else {
reason.c_str())); LOGERR(("MimeHandlerMail: cant md5 [%s]: %s\n", fn.c_str(),
reason.c_str()));
}
} }
m_fd = open(fn.c_str(), 0); m_fd = open(fn.c_str(), 0);
if (m_fd < 0) { if (m_fd < 0) {
LOGERR(("MimeHandlerMail::set_document_file: open(%s) errno %d\n", 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())); LOGDEB2(("Message text: [%s]\n", msgtxt.c_str()));
delete m_stream; delete m_stream;
string md5, xmd5; if (!m_forPreview) {
MD5String(msgtxt, md5); string md5, xmd5;
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5); MD5String(msgtxt, md5);
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
}
if ((m_stream = new stringstream(msgtxt)) == 0 || !m_stream->good()) { if ((m_stream = new stringstream(msgtxt)) == 0 || !m_stream->good()) {
LOGERR(("MimeHandlerMail::set_document_string: stream create error." 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")); LOGDEB(("file_to_string OK\n"));
m_offs = m_text.length(); m_offs = m_text.length();
} }
if (!m_forPreview) {
string md5, xmd5; string md5, xmd5;
MD5String(m_text, md5); MD5String(m_text, md5);
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5); m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
}
m_havedoc = true; m_havedoc = true;
return true; return true;
} }
@ -93,9 +94,11 @@ bool MimeHandlerText::set_document_file(const string &fn)
bool MimeHandlerText::set_document_string(const string& otext) bool MimeHandlerText::set_document_string(const string& otext)
{ {
m_text = otext; m_text = otext;
string md5, xmd5; if (!m_forPreview) {
MD5String(m_text, md5); string md5, xmd5;
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5); MD5String(m_text, md5);
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
}
m_havedoc = true; m_havedoc = true;
return 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 can specify the format for the list entries: what data is
displayed for each hit document and how. This used to include displayed for each hit document and how. This used to include
"almost full" support for HTML capabilities, with a few "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 <p>As of Recoll 1.17, the result list is a WebKit object by
object (WebKit is the basis for several major browsers), which default (WebKit is the basis for several major browsers),
yields full CSS and even Javascript support.</p> which yields full CSS and even Javascript support.</p>
<h2>New in Recoll 1.17: the WebKit result list</h2> <h2>New in Recoll 1.17: the WebKit result list</h2>