diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp index 73f36fb4..e7e18d5d 100644 --- a/src/qtgui/guiutils.cpp +++ b/src/qtgui/guiutils.cpp @@ -293,6 +293,7 @@ void rwSettings(bool writing) SETTING_RW(prefs.fileTypesByCats, "/Recoll/prefs/query/asearchFilTypByCat", Bool, false); + SETTING_RW(prefs.noClearSearch, "/Recoll/prefs/noClearSearch", Bool, false); SETTING_RW(prefs.noToolbars, "/Recoll/prefs/noToolbars", Bool, false); SETTING_RW(prefs.showTrayIcon, "/Recoll/prefs/showTrayIcon", Bool, false); SETTING_RW(prefs.closeToTray, "/Recoll/prefs/closeToTray", Bool, false); diff --git a/src/qtgui/guiutils.h b/src/qtgui/guiutils.h index 01fdc7a9..72641691 100644 --- a/src/qtgui/guiutils.h +++ b/src/qtgui/guiutils.h @@ -141,6 +141,7 @@ class PrefsPack { bool noBeeps; bool noToolbars{false}; + bool noClearSearch{false}; bool showTrayIcon{false}; bool closeToTray{false}; bool trayMessages{false}; diff --git a/src/qtgui/ssearch_w.cpp b/src/qtgui/ssearch_w.cpp index 12fa1e43..fb9f5fa0 100644 --- a/src/qtgui/ssearch_w.cpp +++ b/src/qtgui/ssearch_w.cpp @@ -187,6 +187,20 @@ void SSearch::init() connect(m_completer, SIGNAL(activated(const QString&)), this, SLOT(onCompletionActivated(const QString&))); connect(historyPB, SIGNAL(clicked()), this, SLOT(onHistoryClicked())); + setupButtons(); +} + +void SSearch::setupButtons() +{ + if (prefs.noClearSearch) { + clearqPB->hide(); + searchPB->hide(); + queryText->setClearButtonEnabled(true); + } else { + clearqPB->show(); + searchPB->show(); + queryText->setClearButtonEnabled(false); + } } void SSearch::takeFocus() diff --git a/src/qtgui/ssearch_w.h b/src/qtgui/ssearch_w.h index 71abb126..d3a36f25 100644 --- a/src/qtgui/ssearch_w.h +++ b/src/qtgui/ssearch_w.h @@ -84,7 +84,8 @@ public: virtual bool fromXML(const SSearchDef& fxml); virtual QString currentText(); virtual bool eventFilter(QObject *target, QEvent *event); - + virtual void setupButtons(); + public slots: virtual void onSearchTypeChanged(int); virtual void setSearchString(const QString& text); diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui index 2f0f6d30..6cc4a747 100644 --- a/src/qtgui/uiprefs.ui +++ b/src/qtgui/uiprefs.ui @@ -172,6 +172,16 @@ + + + + Hide Clear and Search buttons. + + + false + + + diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index f2398e72..dfa89833 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -145,6 +145,7 @@ void UIPrefsDialog::setFromPrefs() keepSortCB->setChecked(prefs.keepSort); noToolbarsCB->setChecked(prefs.noToolbars); + noClearSearchCB->setChecked(prefs.noClearSearch); showTrayIconCB->setChecked(prefs.showTrayIcon); if (!prefs.showTrayIcon) { prefs.closeToTray = false; @@ -349,6 +350,8 @@ void UIPrefsDialog::accept() prefs.keepSort = keepSortCB->isChecked(); prefs.noToolbars = noToolbarsCB->isChecked(); + prefs.noClearSearch = noClearSearchCB->isChecked(); + m_mainWindow->sSearch->setupButtons(); m_mainWindow->setupToolbars(); prefs.showTrayIcon = showTrayIconCB->isChecked(); m_mainWindow->enableTrayIcon(prefs.showTrayIcon);