calibre show-book URL: clear the current search if the book to be shown is not in the search results.

This commit is contained in:
Charles Haley 2023-03-19 14:22:44 +00:00
parent 32618d741f
commit 762c1c0a19
2 changed files with 7 additions and 2 deletions

View File

@ -56,6 +56,8 @@ brackets at the end of the path to the book folder.
You can copy a link to the current book displayed in calibre by right clicking You can copy a link to the current book displayed in calibre by right clicking
the :guilabel:`Book details` panel and choosing :guilabel:`Copy link to book`. the :guilabel:`Book details` panel and choosing :guilabel:`Copy link to book`.
If a search is active and the book is not matched by the search then the search is cleared.
If a Virtual library is selected, calibre will use it when showing the book. If If a Virtual library is selected, calibre will use it when showing the book. If
the book isn't found in that virtual library then the virtual library is cleared. the book isn't found in that virtual library then the virtual library is cleared.
@ -65,8 +67,8 @@ If you want to switch to a particular Virtual library when showing the book, use
or or
calibre://show-book/Library_Name/book_id?encoded_virtual_library=hex_encoded_virtual_library_name calibre://show-book/Library_Name/book_id?encoded_virtual_library=hex_encoded_virtual_library_name
replacing spaces in the Virtual library name by ``%20``. If the book isn't in that replacing spaces in the Virtual library name by ``%20``. If the book isn't found in that
virtual library then it is ignored. virtual library then the virtual library is ignored.
Open a specific book in the E-book viewer at a specific position Open a specific book in the E-book viewer at a specific position

View File

@ -711,6 +711,9 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
if vl is not None and vl != '_': if vl is not None and vl != '_':
self.apply_virtual_library(vl) self.apply_virtual_library(vl)
rows = self.library_view.select_rows((book_id,)) rows = self.library_view.select_rows((book_id,))
if not rows:
self.search.set_search_string('')
rows = self.library_view.select_rows((book_id,))
db = self.current_db db = self.current_db
if not rows and (db.data.get_base_restriction_name() or db.data.get_search_restriction_name()): if not rows and (db.data.get_base_restriction_name() or db.data.get_search_restriction_name()):
self.apply_virtual_library() self.apply_virtual_library()