From 208619697af287b1b0c6a91aa1c01e4fa1885b47 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Mon, 20 Jul 2015 19:17:53 +0200 Subject: [PATCH] Allow starting with fixed simple search mode instead of last remembered value --- src/doc/user/usermanual.xml | 43 ++++++++++++++++++------------------- src/qtgui/guiutils.cpp | 1 + src/qtgui/guiutils.h | 2 ++ src/qtgui/rclmain_w.cpp | 5 ++++- src/qtgui/uiprefs.ui | 17 +++++++++++++++ src/qtgui/uiprefs_w.cpp | 22 +++++++++++++++++++ 6 files changed, 67 insertions(+), 23 deletions(-) diff --git a/src/doc/user/usermanual.xml b/src/doc/user/usermanual.xml index b23072b4..3b8c1227 100644 --- a/src/doc/user/usermanual.xml +++ b/src/doc/user/usermanual.xml @@ -2455,37 +2455,36 @@ MimeType=*/* one: use PRE tags with line wrapping. - 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 Open 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. + Choose editor + applicationsr: this opens a dialog which allows you + to select the application to be used to open each MIME + type. The default is nornally to use the + xdg-open utility, but you can override it. - Exceptions: when using the - desktop preferences for opening documents, these are MIME types - that will still be opened according to &RCL; preferences. This - is useful for passing parameters like page numbers or search - strings to applications that support them + Exceptions: even wen + xdg-open is used by default for opening + documents, you can set exceptions for MIME types that will + still be opened according to &RCL; preferences. This is useful + for passing parameters like page numbers or search strings to + applications that support them (e.g. evince). This cannot be done with xdg-open which only supports passing one parameter. - Choose editor applications - this will let you choose the command started by the - Open links inside the result list, for - specific document types. - - - Display category filter as - toolbar... this will let you choose if the document - categories are displayed as a list or a set of buttons. + Document filter choice + style: this will let you choose if the document + categories are displayed as a list or a set of buttons, or a + menu. + Start with simple search + mode: this lets you choose the value of the simple + search type on program startup. Either a fixed value + (e.g. Query Language, or the value in use + when the program last exited. + Auto-start simple search on white space entry: if this is checked, a search will be executed each time you enter a space in the simple search input diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp index 79493ded..b8d65f22 100644 --- a/src/qtgui/guiutils.cpp +++ b/src/qtgui/guiutils.cpp @@ -85,6 +85,7 @@ void rwSettings(bool writing) SETTING_RW(prefs.pvheight, "/Recoll/geometry/pvheight", Int, 0); SETTING_RW(prefs.toolArea, "/Recoll/geometry/toolArea", Int, 0); SETTING_RW(prefs.resArea, "/Recoll/geometry/resArea", Int, 0); + SETTING_RW(prefs.ssearchTypSav, "/Recoll/prefs/ssearchTypSav", Bool, 0); SETTING_RW(prefs.ssearchTyp, "/Recoll/prefs/simpleSearchTyp", Int, 3); SETTING_RW(prefs.startWithAdvSearchOpen, "/Recoll/prefs/startWithAdvSearchOpen", Bool, false); diff --git a/src/qtgui/guiutils.h b/src/qtgui/guiutils.h index ec54d3e1..a2ebd3d8 100644 --- a/src/qtgui/guiutils.h +++ b/src/qtgui/guiutils.h @@ -74,6 +74,8 @@ class PrefsPack { int pvheight; int toolArea; // Area for "tools" toolbar int resArea; // Area for "results" toolbar + bool ssearchTypSav; // Remember last search mode (else always + // start with same) int ssearchTyp; // Use single app (default: xdg-open), instead of per-mime settings bool useDesktopOpen; diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index 7dd90d62..e9436997 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -619,7 +619,10 @@ void RclMain::fileExit() prefs.resArea = toolBarArea(m_resTB); restable->saveColState(); - prefs.ssearchTyp = sSearch->searchTypCMB->currentIndex(); + if (prefs.ssearchTypSav) { + prefs.ssearchTyp = sSearch->searchTypCMB->currentIndex(); + } + if (asearchform) delete asearchform; diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui index 122649aa..b6ee9dfd 100644 --- a/src/qtgui/uiprefs.ui +++ b/src/qtgui/uiprefs.ui @@ -227,6 +227,23 @@ + + + + + + Start with simple search mode + + + false + + + + + + + + diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index db999ad4..b1f685f2 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -59,6 +59,13 @@ void UIPrefsDialog::init() { m_viewAction = 0; + // See enum above and keep in order ! + ssearchTypCMB->addItem(tr("Any term")); + ssearchTypCMB->addItem(tr("All terms")); + ssearchTypCMB->addItem(tr("File name")); + ssearchTypCMB->addItem(tr("Query language")); + ssearchTypCMB->addItem(tr("Value from previous program exit")); + connect(viewActionPB, SIGNAL(clicked()), this, SLOT(showViewAction())); connect(reslistFontPB, SIGNAL(clicked()), this, SLOT(showFontDialog())); connect(resetFontPB, SIGNAL(clicked()), this, SLOT(resetReslistFont())); @@ -103,6 +110,12 @@ void UIPrefsDialog::setFromPrefs() collapseDupsCB->setChecked(prefs.collapseDuplicates); maxHLTSB->setValue(prefs.maxhltextmbs); + if (prefs.ssearchTypSav) { + ssearchTypCMB->setCurrentIndex(4); + } else { + ssearchTypCMB->setCurrentIndex(prefs.ssearchTyp); + } + switch (prefs.filterCtlStyle) { case PrefsPack::FCS_MN: filterMN_RB->setChecked(1); @@ -241,6 +254,15 @@ void UIPrefsDialog::accept() prefs.ssearchNoComplete = ssNoCompleteCB->isChecked(); prefs.ssearchAsYouType = ssAutoAllCB->isChecked(); + if (ssearchTypCMB->currentIndex() == 4) { + prefs.ssearchTypSav = true; + // prefs.ssearchTyp will be set from the current value when + // exiting the program + } else { + prefs.ssearchTypSav = false; + prefs.ssearchTyp = ssearchTypCMB->currentIndex(); + } + if (filterMN_RB->isChecked()) { prefs.filterCtlStyle = PrefsPack::FCS_MN; } else if (filterCMB_RB->isChecked()) {