diff --git a/src/doc/user/usermanual.sgml b/src/doc/user/usermanual.sgml
index 790a713b..167e8b0f 100644
--- a/src/doc/user/usermanual.sgml
+++ b/src/doc/user/usermanual.sgml
@@ -24,7 +24,7 @@
Dockes
- $Id: usermanual.sgml,v 1.39 2007-02-07 17:17:11 dockes Exp $
+ $Id: usermanual.sgml,v 1.40 2007-02-14 10:10:42 dockes Exp $
This document introduces full text search notions
@@ -1266,6 +1266,24 @@ fvwm
not...
+ Start with advanced search dialog open
+ and Start with sort dialog open:
+ If you use these dialogs all the time, checking these
+ entries will get them to open when recoll starts.
+
+
+ Use desktop preferences to choose
+ document editor: if this is checked, the
+ xdg-open
+ utility will be used to open files when you click the
+ Edit link in the result list, instead of
+ the application defined in
+ mimeview. xdg-open
+ will in term use your desktop preferences to choose an
+ appropriate application.
+
+
+
@@ -1915,6 +1933,11 @@ skippedPaths = ~/somedir/*.txt
Please note that these entries must be placed under a
[view] section.
+ If Use desktop preferences to choose
+ document editor is checked in the user preferences,
+ all mimeview entries will be ignored
+ except the one labelled application/x-all
+ (which is set to use xdg-open by default).
diff --git a/src/makestaticdist.sh b/src/makestaticdist.sh
index ecc0ce5b..60efd5f6 100644
--- a/src/makestaticdist.sh
+++ b/src/makestaticdist.sh
@@ -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"
diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp
index 1e3d4f5e..e28aede0 100644
--- a/src/qtgui/guiutils.cpp
+++ b/src/qtgui/guiutils.cpp
@@ -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,
diff --git a/src/qtgui/guiutils.h b/src/qtgui/guiutils.h
index 1fce624e..4ab80d3b 100644
--- a/src/qtgui/guiutils.h
+++ b/src/qtgui/guiutils.h
@@ -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;
diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp
index cddbf5ef..55e1be9c 100644
--- a/src/qtgui/rclmain_w.cpp
+++ b/src/qtgui/rclmain_w.cpp
@@ -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 ?")
diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui
index ad2e6ff0..2d7df805 100644
--- a/src/qtgui/uiprefs.ui
+++ b/src/qtgui/uiprefs.ui
@@ -308,6 +308,17 @@
false
+
+
+ useDesktopOpenCB
+
+
+ Use desktop preferences to choose document editor.
+
+
+ false
+
+
diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp
index 3ee317cb..dc3d16fe 100644
--- a/src/qtgui/uiprefs_w.cpp
+++ b/src/qtgui/uiprefs_w.cpp
@@ -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();
diff --git a/src/recollinstall.in b/src/recollinstall.in
index 0737f81b..805c2e81 100755
--- a/src/recollinstall.in
+++ b/src/recollinstall.in
@@ -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 \
diff --git a/src/sampleconf/mimeview b/src/sampleconf/mimeview
index 68229773..71eab445 100644
--- a/src/sampleconf/mimeview
+++ b/src/sampleconf/mimeview
@@ -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