permit starting an info viewer (info) on an internal gnu info node. This needed a small shell script and a slight modification in how we search from the viewer command in rclmain_w.cpp. The path is now always searched before the filters directory even if useDesktopOpen is set
This commit is contained in:
parent
3e67ba00d4
commit
b90a31ad70
@ -806,7 +806,7 @@ fvwm
|
|||||||
|
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
<listitem><para><guilabel>Preview</guilabel></para></listitem>
|
<listitem><para><guilabel>Preview</guilabel></para></listitem>
|
||||||
<listitem><para><guilabel>Edit</guilabel></para></listitem>
|
<listitem><para><guilabel>Open</guilabel></para></listitem>
|
||||||
<listitem><para><guilabel>Copy File Name</guilabel></para></listitem>
|
<listitem><para><guilabel>Copy File Name</guilabel></para></listitem>
|
||||||
<listitem><para><guilabel>Copy Url</guilabel></para></listitem>
|
<listitem><para><guilabel>Copy Url</guilabel></para></listitem>
|
||||||
<listitem><para><guilabel>Save to File</guilabel></para></listitem>
|
<listitem><para><guilabel>Save to File</guilabel></para></listitem>
|
||||||
@ -818,7 +818,7 @@ fvwm
|
|||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
<para>The <guilabel>Preview</guilabel> and
|
<para>The <guilabel>Preview</guilabel> and
|
||||||
<guilabel>Edit</guilabel> entries do the same thing as the
|
<guilabel>Open</guilabel> entries do the same thing as the
|
||||||
corresponding links.</para>
|
corresponding links.</para>
|
||||||
|
|
||||||
<para>The <guilabel>Copy File Name</guilabel> and
|
<para>The <guilabel>Copy File Name</guilabel> and
|
||||||
@ -1638,7 +1638,7 @@ fvwm
|
|||||||
<listitem><para><guilabel>Use desktop preferences to choose
|
<listitem><para><guilabel>Use desktop preferences to choose
|
||||||
document editor</guilabel>: if this is checked, the
|
document editor</guilabel>: if this is checked, the
|
||||||
<command>xdg-open</command> utility will be used to open files
|
<command>xdg-open</command> utility will be used to open files
|
||||||
when you click the <guilabel>Edit</guilabel> link in the result
|
when you click the <guilabel>Open</guilabel> link in the result
|
||||||
list, instead of the application defined in
|
list, instead of the application defined in
|
||||||
<filename>mimeview</filename>. <command>xdg-open</command> will
|
<filename>mimeview</filename>. <command>xdg-open</command> will
|
||||||
in term use your desktop preferences to choose an appropriate
|
in term use your desktop preferences to choose an appropriate
|
||||||
@ -1647,7 +1647,7 @@ fvwm
|
|||||||
|
|
||||||
<listitem><para><guilabel>Choose editor applications</guilabel>
|
<listitem><para><guilabel>Choose editor applications</guilabel>
|
||||||
this will let you choose the command started by the
|
this will let you choose the command started by the
|
||||||
<guilabel>Edit</guilabel> links inside the result list, for
|
<guilabel>Open</guilabel> links inside the result list, for
|
||||||
specific document types.</para>
|
specific document types.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
@ -3580,7 +3580,7 @@ x-my-tag = mailmytag
|
|||||||
<title>The mimeview file</title>
|
<title>The mimeview file</title>
|
||||||
|
|
||||||
<para><filename>mimeview</filename> specifies which programs
|
<para><filename>mimeview</filename> specifies which programs
|
||||||
are started when you click on an <guilabel>Edit</guilabel>
|
are started when you click on an <guilabel>Open</guilabel>
|
||||||
link in a result list. Ie: HTML is normally displayed using
|
link in a result list. Ie: HTML is normally displayed using
|
||||||
<application>firefox</application>, but you may prefer
|
<application>firefox</application>, but you may prefer
|
||||||
<application>Konqueror</application>, your
|
<application>Konqueror</application>, your
|
||||||
@ -3612,13 +3612,44 @@ x-my-tag = mailmytag
|
|||||||
except the one labelled <literal>application/x-all</literal>
|
except the one labelled <literal>application/x-all</literal>
|
||||||
(which is set to use <command>xdg-open</command> by default).</para>
|
(which is set to use <command>xdg-open</command> by default).</para>
|
||||||
|
|
||||||
|
|
||||||
<para>The <literal>nouncompforviewmts</literal> entry, (placed at
|
<para>The <literal>nouncompforviewmts</literal> entry, (placed at
|
||||||
the top level, outside of the <literal>[view]</literal> section),
|
the top level, outside of the <literal>[view]</literal> section),
|
||||||
holds a list of mime types that should not be uncompressed before
|
holds a list of mime types that should not be uncompressed before
|
||||||
starting the viewer (if they are found compressed, ie:
|
starting the viewer (if they are found compressed, ie:
|
||||||
<replaceable>mydoc.doc.gz</replaceable>).</para>
|
<replaceable>mydoc.doc.gz</replaceable>).</para>
|
||||||
|
|
||||||
|
<para>The right side of each assignment holds a command to be
|
||||||
|
executed for opening the file. The following substitutions are
|
||||||
|
performed:</para>
|
||||||
|
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem>
|
||||||
|
<formalpara><title>%D</title><para>Document date</para></formalpara>
|
||||||
|
</listitem>
|
||||||
|
<listitem><formalpara><title>%f</title><para>File name. This the
|
||||||
|
name of a temporary file if it was necessary to create one (ie:
|
||||||
|
to extract a subdocument from a container).</para></formalpara>
|
||||||
|
</listitem>
|
||||||
|
<listitem><formalpara><title>%F</title><para>Original file name.
|
||||||
|
Same as %f except if a temporary file is used.</para></formalpara>
|
||||||
|
</listitem>
|
||||||
|
<listitem><formalpara><title>%i</title><para>Internal path, for
|
||||||
|
subdocuments of containers. The format depends on the container
|
||||||
|
type.</para></formalpara>
|
||||||
|
</listitem>
|
||||||
|
<listitem><formalpara><title>%M</title><para>Mime
|
||||||
|
type</para></formalpara>
|
||||||
|
</listitem>
|
||||||
|
<listitem><formalpara><title>%U, %u</title><para>Url.
|
||||||
|
</para></formalpara>
|
||||||
|
</listitem>
|
||||||
|
</itemizedlist>
|
||||||
|
|
||||||
|
<para>In addition to the predefined values above, all strings like
|
||||||
|
<literal>%(fieldname)</literal> will be replaced by the value of
|
||||||
|
the field named <literal>fieldname</literal> for the
|
||||||
|
document.</para>
|
||||||
|
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2 id="rcl.install.config.examples">
|
<sect2 id="rcl.install.config.examples">
|
||||||
@ -3629,7 +3660,7 @@ x-my-tag = mailmytag
|
|||||||
|
|
||||||
<para>Imagine that you have some kind of file which does not
|
<para>Imagine that you have some kind of file which does not
|
||||||
have indexable content, but for which you would like to have a
|
have indexable content, but for which you would like to have a
|
||||||
functional <guilabel>Edit</guilabel> link in the result list
|
functional <guilabel>Open</guilabel> link in the result list
|
||||||
(when found by file name). The file names end in
|
(when found by file name). The file names end in
|
||||||
<replaceable>.blob</replaceable> and can be displayed by
|
<replaceable>.blob</replaceable> and can be displayed by
|
||||||
application <replaceable>blobviewer</replaceable>.</para>
|
application <replaceable>blobviewer</replaceable>.</para>
|
||||||
|
|||||||
32
src/filters/rclshowinfo
Executable file
32
src/filters/rclshowinfo
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# A small script to help recoll start info on the node corresponding to
|
||||||
|
# the result document. The title is the node path, but it needs to be
|
||||||
|
# somewhat processed
|
||||||
|
|
||||||
|
fatal()
|
||||||
|
{
|
||||||
|
echo $*
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
Usage()
|
||||||
|
{
|
||||||
|
fatal "Usage: rclshowinfo filename top node / sub node [/ ...]"
|
||||||
|
}
|
||||||
|
|
||||||
|
test $# -ge 2 || Usage
|
||||||
|
filename=`echo $1 | sed -e 's!^file://!!'`
|
||||||
|
shift
|
||||||
|
|
||||||
|
# The title set by recoll while indexing is like:
|
||||||
|
# infofilename / first node path element / second node path element ...
|
||||||
|
IFS=/
|
||||||
|
set $*
|
||||||
|
while test $# -gt 1;do
|
||||||
|
shift
|
||||||
|
# node=`echo $1 | sed -e 's/^ *//' -e 's/ *$//'`
|
||||||
|
node=`eval "echo $1"`
|
||||||
|
nodepath="$nodepath '$node'"
|
||||||
|
done
|
||||||
|
|
||||||
|
set -x
|
||||||
|
exec xterm -e "info -f $filename $nodepath"
|
||||||
@ -946,7 +946,7 @@ void RclMain::saveDocToFile(int docnum)
|
|||||||
static bool lookForHtmlBrowser(string &exefile)
|
static bool lookForHtmlBrowser(string &exefile)
|
||||||
{
|
{
|
||||||
static const char *htmlbrowserlist =
|
static const char *htmlbrowserlist =
|
||||||
"opera konqueror firefox mozilla netscape epiphany";
|
"opera google-chrome konqueror firefox mozilla netscape epiphany";
|
||||||
vector<string> blist;
|
vector<string> blist;
|
||||||
stringToTokens(htmlbrowserlist, blist, " ");
|
stringToTokens(htmlbrowserlist, blist, " ");
|
||||||
|
|
||||||
@ -1003,7 +1003,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
|||||||
cmdplusattr = rclconfig->getMimeViewerDef(doc.mimetype, apptag);
|
cmdplusattr = rclconfig->getMimeViewerDef(doc.mimetype, apptag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmdplusattr.length() == 0) {
|
if (cmdplusattr.empty()) {
|
||||||
QMessageBox::warning(0, "Recoll",
|
QMessageBox::warning(0, "Recoll",
|
||||||
tr("No external viewer configured for mime type [")
|
tr("No external viewer configured for mime type [")
|
||||||
+ doc.mimetype.c_str() + "]");
|
+ doc.mimetype.c_str() + "]");
|
||||||
@ -1029,27 +1029,31 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for the command to execute in the exec path and a few
|
// Look for the command to execute in the exec path and the filters
|
||||||
// other places
|
// directory
|
||||||
string cmdpath;
|
string cmdpath;
|
||||||
if (prefs.useDesktopOpen) {
|
if (!ExecCmd::which(lcmd.front(), cmdpath)) {
|
||||||
// Findfilter searches the recoll filters directory in
|
|
||||||
// addition to the path. We store a copy of xdg-open there, to be
|
|
||||||
// used as last resort
|
|
||||||
cmdpath = rclconfig->findFilter(lcmd.front());
|
cmdpath = rclconfig->findFilter(lcmd.front());
|
||||||
} else {
|
// findFilter returns its input param if the filter is not in
|
||||||
ExecCmd::which(lcmd.front(), cmdpath);
|
// the normal places. As we already looked in the path, we
|
||||||
}
|
// have no use for a simple command name here (as opposed to
|
||||||
|
// mimehandler which will just let execvp do its thing). Erase
|
||||||
|
// cmdpath so that the user dialog will be started further
|
||||||
|
// down.
|
||||||
|
if (!cmdpath.compare(lcmd.front()))
|
||||||
|
cmdpath.erase();
|
||||||
|
|
||||||
// Specialcase text/html because of the help browser need
|
// Specialcase text/html because of the help browser need
|
||||||
if (cmdpath.empty() && !doc.mimetype.compare("text/html")) {
|
if (cmdpath.empty() && !doc.mimetype.compare("text/html")) {
|
||||||
if (lookForHtmlBrowser(cmdpath)) {
|
if (lookForHtmlBrowser(cmdpath)) {
|
||||||
lcmd.clear();
|
lcmd.clear();
|
||||||
lcmd.push_back(cmdpath);
|
lcmd.push_back(cmdpath);
|
||||||
lcmd.push_back("%u");
|
lcmd.push_back("%u");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Command not found: start the user dialog to help find another one:
|
// Command not found: start the user dialog to help find another one:
|
||||||
if (cmdpath.empty()) {
|
if (cmdpath.empty()) {
|
||||||
QString mt = QString::fromAscii(doc.mimetype.c_str());
|
QString mt = QString::fromAscii(doc.mimetype.c_str());
|
||||||
@ -1073,12 +1077,13 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We may need a temp file, or not depending on the command arguments
|
// We may need a temp file, or not, depending on the command
|
||||||
// and the fact that this is a subdoc or not.
|
// arguments and the fact that this is a subdoc or not.
|
||||||
bool wantsipath = (cmd.find("%i") != string::npos) || ignoreipath;
|
bool wantsipath = (cmd.find("%i") != string::npos) || ignoreipath;
|
||||||
bool wantsfile = cmd.find("%f") != string::npos;
|
bool wantsfile = cmd.find("%f") != string::npos;
|
||||||
bool istempfile = false;
|
bool istempfile = false;
|
||||||
string fn = fileurltolocalpath(doc.url);
|
string fn = fileurltolocalpath(doc.url);
|
||||||
|
string orgfn = fn;
|
||||||
string url = doc.url;
|
string url = doc.url;
|
||||||
|
|
||||||
// If the command wants a file but this is not a file url, or
|
// If the command wants a file but this is not a file url, or
|
||||||
@ -1139,6 +1144,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
|||||||
map<string, string> subs;
|
map<string, string> subs;
|
||||||
subs["D"] = efftime;
|
subs["D"] = efftime;
|
||||||
subs["f"] = fn;
|
subs["f"] = fn;
|
||||||
|
subs["F"] = orgfn;
|
||||||
subs["i"] = doc.ipath;
|
subs["i"] = doc.ipath;
|
||||||
subs["M"] = doc.mimetype;
|
subs["M"] = doc.mimetype;
|
||||||
subs["U"] = url;
|
subs["U"] = url;
|
||||||
@ -1156,7 +1162,8 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
|||||||
*it = ncmd;
|
*it = ncmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also substitute inside the unsplitted command line for displaying
|
// Also substitute inside the unsplitted command line and display
|
||||||
|
// in status bar
|
||||||
pcSubst(cmd, ncmd, subs);
|
pcSubst(cmd, ncmd, subs);
|
||||||
ncmd += " &";
|
ncmd += " &";
|
||||||
QStatusBar *stb = statusBar();
|
QStatusBar *stb = statusBar();
|
||||||
|
|||||||
@ -62,6 +62,7 @@ image/svg+xml = inkview %f
|
|||||||
image/vnd.djvu = djview %f
|
image/vnd.djvu = djview %f
|
||||||
# Or firefox -remote "openFile(%u)"
|
# Or firefox -remote "openFile(%u)"
|
||||||
text/html = firefox %u
|
text/html = firefox %u
|
||||||
|
text/html|gnuinfo = rclshowinfo %F %(title)
|
||||||
text/plain = gnuclient -q %f
|
text/plain = gnuclient -q %f
|
||||||
text/x-c = gnuclient -q %f
|
text/x-c = gnuclient -q %f
|
||||||
text/x-html-sidux-man = konqueror %f
|
text/x-html-sidux-man = konqueror %f
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user