autophrase parameter

This commit is contained in:
dockes 2006-09-13 15:31:07 +00:00
parent 347fa3f962
commit e8c65d61c2
5 changed files with 36 additions and 6 deletions

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.17 2006-09-13 13:53:35 dockes Exp $ (C) 2005 Jean-Francois Dockes";
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.18 2006-09-13 15:31:06 dockes Exp $ (C) 2005 Jean-Francois Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -139,6 +139,8 @@ void rwSettings(bool writing)
SETTING_RW(prefs.showicons, "/Recoll/prefs/reslist/showicons", Bool, true);
SETTING_RW(prefs.autoSearchOnWS, "/Recoll/prefs/reslist/autoSearchOnWS",
Bool, false);
SETTING_RW(prefs.ssearchAutoPhrase,
"/Recoll/prefs/startWithSortToolOpen", Bool, false);
SETTING_RW(prefs.respagesize, "/Recoll/prefs/reslist/pagelen", Num, 8);
SETTING_RW(prefs.reslistfontfamily, "/Recoll/prefs/reslist/fontFamily", ,
"");
@ -164,6 +166,8 @@ void rwSettings(bool writing)
prefs.ssearchHistory =
settings.readListEntry("/Recoll/prefs/query/ssearchHistory");
}
SETTING_RW(prefs.ssearchAutoPhrase,
"/Recoll/prefs/query/ssearchAutoPhrase", Bool, false);
// Ssearch combobox history list
if (writing) {

View File

@ -17,7 +17,7 @@
#ifndef _GUIUTILS_H_INCLUDED_
#define _GUIUTILS_H_INCLUDED_
/*
* @(#$Id: guiutils.h,v 1.9 2006-09-13 13:53:35 dockes Exp $ (C) 2005 Jean-Francois Dockes
* @(#$Id: guiutils.h,v 1.10 2006-09-13 15:31:06 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,9 +75,12 @@ class PrefsPack {
QStringList asearchSubdirHist;
// Textual history of simple searches (this is just the combobox list)
QStringList ssearchHistory;
// Make phrase out of search terms and add to search in simple search
bool ssearchAutoPhrase;
// Ignored file types in adv search (startup default)
QStringList asearchIgnFilTyps;
// Synthetized abstract length and word context size
int syntAbsLen;
int syntAbsCtx;

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: ssearch_w.cpp,v 1.5 2006-09-13 13:53:35 dockes Exp $ (C) 2006 J.F.Dockes";
static char rcsid[] = "@(#$Id: ssearch_w.cpp,v 1.6 2006-09-13 15:31:06 dockes Exp $ (C) 2006 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -72,8 +72,17 @@ void SSearch::startSimpleSearch()
QCString u8 = queryText->currentText().utf8();
switch (searchTypCMB->currentItem()) {
case 0:
default:
default: {
QString comp = queryText->currentText();
// If this is an or and we're set for autophrase and there are
// no quotes in the query, add a phrase search
if (prefs.ssearchAutoPhrase && comp.find('"', 0) == -1) {
comp += QString::fromAscii(" \"") + comp +
QString::fromAscii("\"");
u8 = comp.utf8();
}
sdata.orwords = u8;
}
break;
case 1:
sdata.allwords = u8;

View File

@ -249,6 +249,17 @@
</widget>
</hbox>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>autoPhraseCB</cstring>
</property>
<property name="text">
<string>Automatically add phrase to simple searchs</string>
</property>
<property name="toolTip" stdset="0">
<string>A search for [rolling stones] (2 terms) will be changed to [rolling or stones or (rolling phrase 2 stones)].</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>buildAbsCB</cstring>

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.4 2006-09-13 13:53:35 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.5 2006-09-13 15:31:07 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -97,6 +97,8 @@ void UIPrefsDialog::init()
cur = 0;
stemLangCMB->setCurrentItem(cur);
autoPhraseCB->setChecked(prefs.ssearchAutoPhrase);
buildAbsCB->setChecked(prefs.queryBuildAbstract);
if (!prefs.queryBuildAbstract) {
replAbsCB->setEnabled(false);
@ -151,6 +153,7 @@ void UIPrefsDialog::accept()
} else {
prefs.queryStemLang = stemLangCMB->currentText();
}
prefs.ssearchAutoPhrase = autoPhraseCB->isChecked();
prefs.queryBuildAbstract = buildAbsCB->isChecked();
prefs.queryReplaceAbstract = buildAbsCB->isChecked() &&
replAbsCB->isChecked();