add user pref to use xdg-open for all document edits

This commit is contained in:
dockes 2007-02-14 10:10:43 +00:00
parent a03219b770
commit e58dee2314
9 changed files with 74 additions and 9 deletions

View File

@ -24,7 +24,7 @@
Dockes</holder>
</copyright>
<releaseinfo>$Id: usermanual.sgml,v 1.39 2007-02-07 17:17:11 dockes Exp $</releaseinfo>
<releaseinfo>$Id: usermanual.sgml,v 1.40 2007-02-14 10:10:42 dockes Exp $</releaseinfo>
<abstract>
<para>This document introduces full text search notions
@ -1266,6 +1266,24 @@ fvwm
not...</para>
</listitem>
<listitem><para><guilabel>Start with advanced search dialog open
</guilabel> and <guilabel>Start with sort dialog open</guilabel>:
If you use these dialogs all the time, checking these
entries will get them to open when recoll starts.</para>
</listitem>
<listitem><para><guilabel>Use desktop preferences to choose
document editor</guilabel>: if this is checked, the
<command>xdg-open</command>
utility will be used to open files when you click the
<guilabel>Edit</guilabel> link in the result list, instead of
the application defined in
<filename>mimeview</filename>. <command>xdg-open</command>
will in term use your desktop preferences to choose an
appropriate application.</para>
</listitem>
</itemizedlist>
</para>
</formalpara>
@ -1915,6 +1933,11 @@ skippedPaths = ~/somedir/*.txt
<para>Please note that these entries must be placed under a
<literal>[view]</literal> section.</para>
<para>If <guilabel>Use desktop preferences to choose
document editor</guilabel> is checked in the user preferences,
all <filename>mimeview</filename> entries will be ignored
except the one labelled <literal>application/x-all</literal>
(which is set to use <command>xdg-open</command> by default).</para>
</sect2>
<sect2 id="rclinstall.config.examples">

View File

@ -36,7 +36,7 @@ make static || exit 1
strip index/recollindex qtgui/recoll
files="COPYING README INSTALL VERSION Makefile recoll.desktop recollinstall
filters sampleconf doc/user doc/man
filters desktop sampleconf doc/user doc/man
index/recollindex index/rclmon.sh qtgui/recoll qtgui/i18n/*.qm
qtgui/mtpics/*.png recoll.png"

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.30 2007-02-12 18:14:05 dockes Exp $ (C) 2005 Jean-Francois Dockes";
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.31 2007-02-14 10:10:43 dockes Exp $ (C) 2005 Jean-Francois Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -199,6 +199,8 @@ void rwSettings(bool writing)
prefs.reslistformat = rlfDflt;
SETTING_RW(prefs.queryStemLang, "/Recoll/prefs/query/stemLang", ,
"english");
SETTING_RW(prefs.useDesktopOpen,
"/Recoll/prefs/useDesktopOpen", Bool, false);
SETTING_RW(prefs.queryBuildAbstract,
"/Recoll/prefs/query/buildAbstract", Bool, true);
SETTING_RW(prefs.queryReplaceAbstract,

View File

@ -17,7 +17,7 @@
#ifndef _GUIUTILS_H_INCLUDED_
#define _GUIUTILS_H_INCLUDED_
/*
* @(#$Id: guiutils.h,v 1.19 2006-12-20 13:12:49 dockes Exp $ (C) 2005 Jean-Francois Dockes
* @(#$Id: guiutils.h,v 1.20 2007-02-14 10:10:43 dockes Exp $ (C) 2005 Jean-Francois Dockes
* jean-francois.dockes@wanadoo.fr
*
* This program is free software; you can redistribute it and/or modify
@ -75,6 +75,7 @@ class PrefsPack {
int pvheight;
int ssearchTyp;
QString htmlBrowser;
bool useDesktopOpen; // typically xdg-open, instead of mimeview settings
bool queryBuildAbstract;
bool queryReplaceAbstract;
bool startWithAdvSearchOpen;

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.24 2007-01-19 15:22:50 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.25 2007-02-14 10:10:43 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -726,7 +726,13 @@ void RclMain::startNativeViewer(int docnum)
void RclMain::startNativeViewer(Rcl::Doc doc)
{
// Look for appropriate viewer
string cmd = rclconfig->getMimeViewerDef(doc.mimetype);
string cmd;
if (prefs.useDesktopOpen) {
cmd = rclconfig->getMimeViewerDef("application/x-all");
} else {
cmd = rclconfig->getMimeViewerDef(doc.mimetype);
}
if (cmd.length() == 0) {
QMessageBox::warning(0, "Recoll",
tr("No external viewer configured for mime type ")
@ -742,8 +748,23 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
.arg(QString::fromLocal8Bit(cmd.c_str())));
return;
}
string cmdpath;
if (!ExecCmd::which(lcmd.front(), cmdpath)) {
if (prefs.useDesktopOpen) {
// Findfilter searches the recoll filters directory in
// addition to the path
cmdpath = rclconfig->findFilter(lcmd.front());
// Substitute path for cmd
if (!cmdpath.empty()) {
lcmd.front() = cmdpath;
cmd.erase();
stringsToString(lcmd, cmd);
}
} else {
ExecCmd::which(lcmd.front(), cmdpath);
}
if (cmdpath.empty()) {
QString message = tr("The viewer specified in mimeconf for %1: %2"
" is not found.\nDo you want to start the "
" preferences dialog ?")

View File

@ -308,6 +308,17 @@
<bool>false</bool>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>useDesktopOpenCB</cstring>
</property>
<property name="text">
<string>Use desktop preferences to choose document editor.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</vbox>
</widget>
</vbox>

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.15 2007-02-08 09:03:29 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.16 2007-02-14 10:10:43 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -104,6 +104,7 @@ void UIPrefsDialog::setFromPrefs()
initStartAdvCB->setChecked(prefs.startWithAdvSearchOpen);
initStartSortCB->setChecked(prefs.startWithSortToolOpen);
useDesktopOpenCB->setChecked(prefs.useDesktopOpen);
// Result list font family and size
reslistFontFamily = prefs.reslistfontfamily;
@ -191,6 +192,7 @@ void UIPrefsDialog::accept()
prefs.startWithAdvSearchOpen = initStartAdvCB->isChecked();
prefs.startWithSortToolOpen = initStartSortCB->isChecked();
prefs.useDesktopOpen = useDesktopOpenCB->isChecked();
prefs.syntAbsLen = syntlenSB->value();
prefs.syntAbsCtx = syntctxSB->value();

View File

@ -78,6 +78,8 @@ ${INSTALL} -m 0755 ${QTGUI}/recoll index/recollindex ${bindir} || exit 1
${STRIP} ${bindir}/recoll ${bindir}/recollindex
${INSTALL} -m 0755 filters/rcl* ${datadir}/recoll/filters/ || exit 1
${INSTALL} -m 0755 desktop/xdg-utils-1.0.1/scripts/xdg-open \
${datadir}/recoll/filters/ || exit 1
${INSTALL} -m 0444 \
sampleconf/mimeconf \

View File

@ -1,10 +1,13 @@
# @(#$Id: mimeview,v 1.3 2007-01-23 07:14:16 dockes Exp $ (C) 2004 J.F.Dockes
# @(#$Id: mimeview,v 1.4 2007-02-14 10:10:43 dockes Exp $ (C) 2004 J.F.Dockes
## ##########################################
# External viewers, launched by the recoll GUI when you click on a result
# 'edit' link
[view]
# Pseudo entry used if the 'use desktop' preference is set in the GUI
application/x-all = xdg-open %f
application/msword = openoffice %f
application/pdf = xpdf %f
application/postscript = gv %f