Also include the result list header fragment in the snippets window header. Add "class" attributes "respar" and "snippets" to the tables to enable selection if needed.

This commit is contained in:
Jean-Francois Dockes 2015-06-08 08:43:00 +02:00
parent 622cacf979
commit 3932a25aa2
4 changed files with 48 additions and 27 deletions

View File

@ -1464,7 +1464,7 @@ fs.inotify.max_user_watches=32768
current result. I can't remember a single instance where this current result. I can't remember a single instance where this
function was actually useful to me...</para> function was actually useful to me...</para>
<para>The <guilabel>Open Snippets Window</guilabel> entry will only <para id="RCL.SEARCH.GUI.RESULTLIST.MENU.SNIPPETS">The <guilabel>Open Snippets Window</guilabel> entry will only
appear for documents which support page breaks (typically appear for documents which support page breaks (typically
PDF, Postscript, DVI). The snippets window lists extracts from PDF, Postscript, DVI). The snippets window lists extracts from
the document, taken around search terms occurrences, along with the the document, taken around search terms occurrences, along with the
@ -2615,29 +2615,39 @@ MimeType=*/*
<sect3 id="RCL.SEARCH.GUI.CUSTOM.RESLIST"> <sect3 id="RCL.SEARCH.GUI.CUSTOM.RESLIST">
<title>The result list format</title> <title>The result list format</title>
<para>The result list presentation can be exhaustively customized <para>Newer versions of Recoll (from 1.17) normally use WebKit HTML
by adjusting two elements:</para> widgets for the result list and the
<itemizedlist> <link linkend="RCL.SEARCH.GUI.RESULTLIST.MENU.SNIPPETS">
<listitem><para>The paragraph format</para></listitem> snippets window</link> (this may be disabled at build time).
<listitem><para>HTML code inside the header Total customisation is possible with full support for CSS and
section</para></listitem>
</itemizedlist>
<para>These can be edited from the <guilabel>Result list</guilabel>
tab of the <guilabel>GUI configuration</guilabel>.</para>
<para>Newer versions of Recoll (from 1.17) use a WebKit HTML
object by default (this may be disabled at build time), and
total customisation is possible with full support for CSS and
Javascript. Conversely, there are limits to what you can do with Javascript. Conversely, there are limits to what you can do with
the older Qt QTextBrowser, but still, it is possible to decide the older Qt QTextBrowser, but still, it is possible to decide
what data each result will contain, and how it will be what data each result will contain, and how it will be
displayed.</para> displayed.</para>
<para>No more detail will be given about the header part (only <para>The result list presentation can be exhaustively customized
useful with the WebKit build), if there are restrictions to by adjusting two elements:
what you can do, they are beyond this author's HTML/CSS/Javascript
abilities... There are a few examples on the <itemizedlist>
<listitem><para>The paragraph format</para></listitem>
<listitem><para>HTML code inside the header section. For
versions 1.21 and later, this is also used for the
<link linkend="RCL.SEARCH.GUI.RESULTLIST.MENU.SNIPPETS">
snippets window</link> </para></listitem>
</itemizedlist>
The paragraph format and the header fragment can be edited
from the <guilabel>Result list</guilabel> tab of the
<guilabel>GUI configuration</guilabel>.
</para>
<para>The header fragment is used both for the result list and
the snippets window. The snippets list is a table and has a
<literal>snippets</literal> class attribute. Each paragraph in
the result list is a table, with class
<literal>respar</literal>, but this can be changed by editing
the paragraph format.</para>
<para>There are a few examples on the
<ulink url="http://www.recoll.org/custom.html">page about <ulink url="http://www.recoll.org/custom.html">page about
customising the result list</ulink> on the &RCL; web site.</para> customising the result list</ulink> on the &RCL; web site.</para>
@ -2733,9 +2743,13 @@ MimeType=*/*
<para>The default value for the paragraph format string is: <para>The default value for the paragraph format string is:
<screen><![CDATA[ <screen><![CDATA[
<img src="%I" align="left">%R %S %L &nbsp;&nbsp;<b>%T</b><br> "<table class=\"respar\">\n"
%M&nbsp;%D&nbsp;&nbsp;&nbsp;<i>%U</i>&nbsp;%i<br> "<tr>\n"
%A %K "<td><a href='%U'><img src='%I' width='64'></a></td>\n"
"<td>%L &nbsp;<i>%S</i> &nbsp;&nbsp;<b>%T</b><br>\n"
"<span style='white-space:nowrap'><i>%M</i>&nbsp;%D</span>&nbsp;&nbsp;&nbsp; <i>%U</i>&nbsp;%i<br>\n"
"%A %K</td>\n"
"</tr></table>\n"
]]></screen> ]]></screen>
You may, for example, try the following for a more web-like You may, for example, try the following for a more web-like

View File

@ -40,10 +40,13 @@ RclConfig *theconfig;
// qt 4.6 qtextedit to clear the margins after the float img without // qt 4.6 qtextedit to clear the margins after the float img without
// introducing blank space. // introducing blank space.
const char *PrefsPack::dfltResListFormat = const char *PrefsPack::dfltResListFormat =
"<table><tr><td><a href='%U'><img src='%I' width='64'></a></td>" "<table class=\"respar\">\n"
"<td>%L &nbsp;<i>%S</i> &nbsp;&nbsp;<b>%T</b><br>" "<tr>\n"
"<span style='white-space:nowrap'><i>%M</i>&nbsp;%D</span>&nbsp;&nbsp;&nbsp; <i>%U</i>&nbsp;%i<br>" "<td><a href='%U'><img src='%I' width='64'></a></td>\n"
"%A %K</td></tr></table>" "<td>%L &nbsp;<i>%S</i> &nbsp;&nbsp;<b>%T</b><br>\n"
"<span style='white-space:nowrap'><i>%M</i>&nbsp;%D</span>&nbsp;&nbsp;&nbsp; <i>%U</i>&nbsp;%i<br>\n"
"%A %K</td>\n"
"</tr></table>\n"
; ;
// The global preferences structure // The global preferences structure

View File

@ -151,11 +151,12 @@ void SnippetsW::init()
oss << "<style type=\"text/css\">\nbody,table,select,input {\n"; oss << "<style type=\"text/css\">\nbody,table,select,input {\n";
oss << "color: " + qs2utf8s(prefs.fontcolor) + ";\n"; oss << "color: " + qs2utf8s(prefs.fontcolor) + ";\n";
oss << "}\n</style>\n"; oss << "}\n</style>\n";
oss << qs2utf8s(prefs.reslistheadertext);
oss << oss <<
"</head>" "</head>"
"<body>" "<body>"
"<table>" "<table class=\"snippets\">"
; ;
g_hiliter.set_inputhtml(false); g_hiliter.set_inputhtml(false);

View File

@ -461,6 +461,9 @@
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<item> <item>
<widget class="QLabel" name="tLSTL1"> <widget class="QLabel" name="tLSTL1">
<property name="toolTip">
<string>User style to apply to the snippets window.&lt;br&gt; Note: the result page header insert is also included in the snippets window header.</string>
</property>
<property name="text"> <property name="text">
<string>Snippets window CSS file</string> <string>Snippets window CSS file</string>
</property> </property>