Advanced search dialog: When starting on the title/author/etc. tab, restore the previously used search kind as well. Fixes #1029745 (Advanced search default to Contains even for existing alternative)

This commit is contained in:
Kovid Goyal 2012-07-27 11:25:22 +05:30
parent 62b135a6c3
commit 79f60d00f3

View File

@ -12,6 +12,7 @@ from calibre.utils.icu import sort_key
from calibre.utils.config import tweaks
box_values = {}
last_matchkind = CONTAINS_MATCH
class SearchDialog(QDialog, Ui_Dialog):
@ -57,6 +58,9 @@ class SearchDialog(QDialog, Ui_Dialog):
current_tab = gprefs.get('advanced search dialog current tab', 0)
self.tabWidget.setCurrentIndex(current_tab)
if current_tab == 1:
self.matchkind.setCurrentIndex(last_matchkind)
self.tabWidget.currentChanged[int].connect(self.tab_changed)
self.tab_changed(current_tab)
@ -173,7 +177,9 @@ class SearchDialog(QDialog, Ui_Dialog):
general_index = unicode(self.general_combo.currentText())
self.box_last_values['general_index'] = general_index
global box_values
global last_matchkind
box_values = copy.deepcopy(self.box_last_values)
last_matchkind = mk
if general:
ans.append(unicode(self.general_combo.currentText()) + ':"' +
self.mc + general + '"')