mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Bug #1996551: Possible bug: Similar books reassigned when grouped search renamed
Revert to the default if the field used in a similar search is removed (or renamed).
This commit is contained in:
parent
e76a124dcb
commit
0d01c12bf4
@ -43,7 +43,8 @@ class SimilarBooksAction(InterfaceAction):
|
|||||||
row = idx.row()
|
row = idx.row()
|
||||||
|
|
||||||
# Get the parameters for this search
|
# Get the parameters for this search
|
||||||
col = db.prefs['similar_' + typ + '_search_key']
|
key = 'similar_' + typ + '_search_key'
|
||||||
|
col = db.prefs[key]
|
||||||
match = db.prefs['similar_' + typ + '_match_kind']
|
match = db.prefs['similar_' + typ + '_match_kind']
|
||||||
if match == 'match_all':
|
if match == 'match_all':
|
||||||
join = ' and '
|
join = ' and '
|
||||||
@ -70,7 +71,11 @@ class SimilarBooksAction(InterfaceAction):
|
|||||||
else:
|
else:
|
||||||
val.add(v)
|
val.add(v)
|
||||||
else:
|
else:
|
||||||
# Get the value of the requested field. Can be a list or a simple val
|
# Get the value of the requested field. Can be a list or a simple
|
||||||
|
# val. It is possible that col no longer exists, in which case fall
|
||||||
|
# back to the default
|
||||||
|
if col not in mi:
|
||||||
|
col = db.prefs.defaults[key]
|
||||||
val = mi.get(col, None)
|
val = mi.get(col, None)
|
||||||
if not val:
|
if not val:
|
||||||
return
|
return
|
||||||
|
@ -133,7 +133,15 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
if dex >= 0:
|
if dex >= 0:
|
||||||
field.setCurrentIndex(dex)
|
field.setCurrentIndex(dex)
|
||||||
else:
|
else:
|
||||||
field.setCurrentIndex(0)
|
# The field no longer exists. Try the default
|
||||||
|
dex = field.findText(self.db.prefs.defaults[name])
|
||||||
|
if dex >= 0:
|
||||||
|
field.setCurrentIndex(dex)
|
||||||
|
else:
|
||||||
|
# The default doesn't exist! Pick the first field in the list
|
||||||
|
field.setCurrentIndex(0)
|
||||||
|
# Emit a changed signal after all the other events have been processed
|
||||||
|
QTimer.singleShot(0, self.changed_signal.emit)
|
||||||
field.blockSignals(False)
|
field.blockSignals(False)
|
||||||
|
|
||||||
def something_changed(self, dex):
|
def something_changed(self, dex):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user