add user pref to use xdg-open for all document edits
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
+24
-3
@@ -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 ?")
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user