add preference to start simple search on completer activation or not

This commit is contained in:
Jean-Francois Dockes 2019-03-07 10:25:41 +01:00
parent 0abf14b7a5
commit 8dbbd380fb
5 changed files with 22 additions and 1 deletions

View File

@ -129,6 +129,8 @@ void rwSettings(bool writing)
SETTING_RW(prefs.ssearchNoComplete, SETTING_RW(prefs.ssearchNoComplete,
"/Recoll/prefs/ssearch/noComplete", Bool, false); "/Recoll/prefs/ssearch/noComplete", Bool, false);
SETTING_RW(prefs.ssearchStartOnComplete,
"/Recoll/prefs/ssearch/startOnComplete", Bool, true);
SETTING_RW(prefs.filterCtlStyle, "/Recoll/prefs/filterCtlStyle", Int, 0); SETTING_RW(prefs.filterCtlStyle, "/Recoll/prefs/filterCtlStyle", Int, 0);
SETTING_RW(prefs.ssearchAutoPhrase, SETTING_RW(prefs.ssearchAutoPhrase,
"/Recoll/prefs/ssearchAutoPhrase", Bool, true); "/Recoll/prefs/ssearchAutoPhrase", Bool, true);

View File

@ -39,6 +39,7 @@ class PrefsPack {
public: public:
// Simple search entry behaviour // Simple search entry behaviour
bool ssearchNoComplete; bool ssearchNoComplete;
bool ssearchStartOnComplete;
// Decide if we display the doc category filter control as a // Decide if we display the doc category filter control as a
// toolbar+combobox or as a button group under simple search // toolbar+combobox or as a button group under simple search
enum FilterCtlStyle {FCS_BT, FCS_CMB, FCS_MN}; enum FilterCtlStyle {FCS_BT, FCS_CMB, FCS_MN};

View File

@ -231,7 +231,9 @@ void SSearch::restoreText()
m_savedEditText = ""; m_savedEditText = "";
} }
queryText->setFocus(); queryText->setFocus();
QTimer::singleShot(0, this, SLOT(startSimpleSearch())); if (prefs.ssearchStartOnComplete) {
QTimer::singleShot(0, this, SLOT(startSimpleSearch()));
}
} }
void SSearch::onCompletionActivated(const QString& text) void SSearch::onCompletionActivated(const QString& text)
{ {

View File

@ -270,6 +270,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="ssSearchOnCompleteCB">
<property name="text">
<string>Start search on completer popup activation.</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="initStartAdvCB"> <widget class="QCheckBox" name="initStartAdvCB">
<property name="text"> <property name="text">

View File

@ -95,6 +95,8 @@ void UIPrefsDialog::init()
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(buildAbsCB, SIGNAL(toggled(bool)), connect(buildAbsCB, SIGNAL(toggled(bool)),
replAbsCB, SLOT(setEnabled(bool))); replAbsCB, SLOT(setEnabled(bool)));
connect(ssNoCompleteCB, SIGNAL(toggled(bool)),
ssSearchOnCompleteCB, SLOT(setDisabled(bool)));
setFromPrefs(); setFromPrefs();
} }
@ -125,6 +127,9 @@ void UIPrefsDialog::setFromPrefs()
break; break;
} }
ssNoCompleteCB->setChecked(prefs.ssearchNoComplete); ssNoCompleteCB->setChecked(prefs.ssearchNoComplete);
ssSearchOnCompleteCB->setChecked(prefs.ssearchStartOnComplete);
ssSearchOnCompleteCB->setEnabled(!prefs.ssearchNoComplete);
syntlenSB->setValue(prefs.syntAbsLen); syntlenSB->setValue(prefs.syntAbsLen);
syntctxSB->setValue(prefs.syntAbsCtx); syntctxSB->setValue(prefs.syntAbsCtx);
@ -256,6 +261,7 @@ void UIPrefsDialog::setupReslistFontPB()
void UIPrefsDialog::accept() void UIPrefsDialog::accept()
{ {
prefs.ssearchNoComplete = ssNoCompleteCB->isChecked(); prefs.ssearchNoComplete = ssNoCompleteCB->isChecked();
prefs.ssearchStartOnComplete = ssSearchOnCompleteCB->isChecked();
if (ssearchTypCMB->currentIndex() == 4) { if (ssearchTypCMB->currentIndex() == 4) {
prefs.ssearchTypSav = true; prefs.ssearchTypSav = true;