When using calibre://show-book URLs and the book is not found, clear any Virtual library or search restriction and then show the book. Fixes #1905113 [Clear current VL when using calibre:// to show book (or add switch VL modifier)](https://bugs.launchpad.net/calibre/+bug/1905113)

This commit is contained in:
Kovid Goyal 2020-11-22 10:03:29 +05:30
parent 80aaffa6ef
commit 31c7ef4167
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 3 deletions

View File

@ -404,7 +404,7 @@ class SearchRestrictionMixin(object):
current_lib = db.data.get_base_restriction_name()
if current_lib == '':
if not current_lib:
a = m.addAction(self.checked, self.no_restriction)
else:
a = m.addAction(self.empty, self.no_restriction)
@ -576,7 +576,7 @@ class SearchRestrictionMixin(object):
self.search_restriction.setCurrentIndex(index)
self.apply_search_restriction(index)
def apply_named_search_restriction(self, name):
def apply_named_search_restriction(self, name=None):
if not self.search_restriction_list_built:
self.build_search_restriction_list()
if not name:

View File

@ -671,7 +671,12 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
return
def doit():
self.library_view.select_rows((book_id,))
rows = self.library_view.select_rows((book_id,))
db = self.current_db
if not rows and (db.data.get_base_restriction_name() or db.data.get_search_restriction_name()):
self.apply_virtual_library()
self.apply_named_search_restriction()
self.library_view.select_rows((book_id,))
self.perform_url_action(library_id, library_path, doit)
elif action == 'view-book':