add option to hide the "Clear" and "Search" buttons

This commit is contained in:
Jean-Francois Dockes 2020-11-18 19:10:35 +01:00
parent a244983b3a
commit a24759c4dd
6 changed files with 31 additions and 1 deletions

View File

@ -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);

View File

@ -141,6 +141,7 @@ class PrefsPack {
bool noBeeps;
bool noToolbars{false};
bool noClearSearch{false};
bool showTrayIcon{false};
bool closeToTray{false};
bool trayMessages{false};

View File

@ -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()

View File

@ -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);

View File

@ -172,6 +172,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="noClearSearchCB">
<property name="text">
<string>Hide Clear and Search buttons.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showTrayIconCB">
<property name="text">

View File

@ -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);