diff --git a/src/calibre/gui2/preferences/__init__.py b/src/calibre/gui2/preferences/__init__.py index 3169cafffa..ffffed091d 100644 --- a/src/calibre/gui2/preferences/__init__.py +++ b/src/calibre/gui2/preferences/__init__.py @@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en' import textwrap from PyQt5.Qt import (QWidget, pyqtSignal, QCheckBox, QAbstractSpinBox, - QLineEdit, QComboBox, Qt, QIcon, QDialog, QVBoxLayout, QRadioButton, + QLineEdit, QComboBox, Qt, QIcon, QDialog, QVBoxLayout, QDialogButtonBox) from calibre.customize.ui import preferences_plugins @@ -101,9 +101,6 @@ class Setting(object): if isinstance(self.gui_obj, QCheckBox): self.datatype = 'bool' self.gui_obj.stateChanged.connect(self.changed) - elif isinstance(self.gui_obj, QRadioButton): - self.datatype = 'bool' - self.gui_obj.toggled.connect(self.changed) elif isinstance(self.gui_obj, QAbstractSpinBox): self.datatype = 'number' self.gui_obj.valueChanged.connect(self.changed) @@ -115,7 +112,7 @@ class Setting(object): self.gui_obj.editTextChanged.connect(self.changed) self.gui_obj.currentIndexChanged.connect(self.changed) else: - raise ValueError('Unknown data type') + raise ValueError('Unknown data type %s' % self.gui_obj.__class__) if isinstance(self.config_obj, ConfigProxy) and \ not unicode(self.gui_obj.toolTip()): diff --git a/src/calibre/gui2/preferences/search.py b/src/calibre/gui2/preferences/search.py index 2cff7a9fca..b0750d8049 100644 --- a/src/calibre/gui2/preferences/search.py +++ b/src/calibre/gui2/preferences/search.py @@ -7,11 +7,13 @@ __docformat__ = 'restructuredtext en' from PyQt5.Qt import QApplication -from calibre.gui2.preferences import ConfigWidgetBase, test_widget, CommaSeparatedList +from calibre.gui2.preferences import ConfigWidgetBase, test_widget, \ + CommaSeparatedList, AbortCommit from calibre.gui2.preferences.search_ui import Ui_Form from calibre.gui2 import config, error_dialog, gprefs from calibre.utils.config import prefs from calibre.utils.icu import sort_key +from calibre.library.caches import set_use_primary_find_in_search class ConfigWidget(ConfigWidgetBase, Ui_Form): @@ -210,6 +212,11 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.gst_value.blockSignals(False) def commit(self): + if self.opt_case_sensitive.isChecked() and self.opt_use_primary_find_in_search.isChecked(): + error_dialog(self, _('Incompatible options'), _( + 'The option to have un-accented characters match accented characters has no effect' + ' if you also turn on case-sensitive searching. So only turn on one of those options'), show=True) + raise AbortCommit() if self.gst_changed: self.db.new_api.set_pref('grouped_search_terms', self.gst) self.db.field_metadata.add_grouped_search_terms(self.gst) @@ -224,7 +231,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): return ConfigWidgetBase.commit(self) def refresh_gui(self, gui): - gui.current_db.new_api.clear_caches() # Clear the search cache + set_use_primary_find_in_search(prefs['use_primary_find_in_search']) gui.set_highlight_only_button_icon() if self.muc_changed: gui.tags_view.recount() diff --git a/src/calibre/gui2/preferences/search.ui b/src/calibre/gui2/preferences/search.ui index 69a5e3029e..c00612777a 100644 --- a/src/calibre/gui2/preferences/search.ui +++ b/src/calibre/gui2/preferences/search.ui @@ -307,14 +307,14 @@ to be shown as user categories - + Case sensitive searching - + Unaccented characters match accented characters diff --git a/src/calibre/utils/config_base.py b/src/calibre/utils/config_base.py index 8baf932b94..bfc8d7b92f 100644 --- a/src/calibre/utils/config_base.py +++ b/src/calibre/utils/config_base.py @@ -440,8 +440,7 @@ def create_global_prefs(conf_obj=None): 'libraries. Note that this option will have no effect if you turn ' 'on case-sensitive searching')%u'\xf1') c.add_opt('case_sensitive', default=False, help=_( - 'Make searches case-sensitive. Note that turning on case-sensitive searches disables matching of ' - 'accented characters by their unaccented versions.')) + 'Make searches case-sensitive')) c.add_opt('migrated', default=False, help='For Internal use. Don\'t modify.') return c