diff --git a/src/calibre/gui2/actions/show_book_details.py b/src/calibre/gui2/actions/show_book_details.py index 4395b4e9ac..6cf2f74d3b 100644 --- a/src/calibre/gui2/actions/show_book_details.py +++ b/src/calibre/gui2/actions/show_book_details.py @@ -66,7 +66,7 @@ class ShowBookDetailsAction(InterfaceAction): self.dialogs[dn] = None try: d = BookInfo(self.gui, self.gui.library_view, index, - self.gui.book_details.handle_click, dialog_number=dn, + self.gui.book_details.handle_click_from_popup, dialog_number=dn, library_id=library_id, library_path=library_path, book_id=book_id) except ValueError as e: error_dialog(self.gui, _('Book not found'), str(e)).exec() diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index 47a9ab8b0a..dbd9ff2b86 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -1314,7 +1314,8 @@ class BookDetails(DetailsLayout): # {{{ url = url_for_author_search(data.where, author=data.author) safe_open_url(url) - def handle_click(self, link): + def handle_click_from_popup(self, link, parent=None): + parent = parent or self typ, val = link.partition(':')[::2] from calibre.gui2.ui import get_gui db = get_gui().current_db.new_api @@ -1370,14 +1371,17 @@ class BookDetails(DetailsLayout): # {{{ if field and db.field_supports_notes(field): item_id = data['item_id'] if item_id is not None and db.notes_for(field, item_id): - return self.show_notes(field, item_id) + return self.show_notes(field, item_id, parent) else: browse(link) - def show_notes(self, field, item_id): + def handle_click(self, link): + self.handle_click_from_popup(link) + + def show_notes(self, field, item_id, parent=None): from calibre.gui2.dialogs.show_category_note import ShowNoteDialog from calibre.gui2.ui import get_gui - ShowNoteDialog(field, item_id, get_gui().current_db.new_api, parent=self).show() + ShowNoteDialog(field, item_id, get_gui().current_db.new_api, parent=parent or self).show() def mouseDoubleClickEvent(self, ev): ev.accept() diff --git a/src/calibre/gui2/dialogs/book_info.py b/src/calibre/gui2/dialogs/book_info.py index 913d21fd0b..4bd0931111 100644 --- a/src/calibre/gui2/dialogs/book_info.py +++ b/src/calibre/gui2/dialogs/book_info.py @@ -303,7 +303,7 @@ class BookInfo(QDialog): def on_link_clicked(self, qurl): link = str(qurl.toString(NO_URL_FORMATTING)) - self.link_delegate(link) + self.link_delegate(link, self) def done(self, r): self.save_geometry(gprefs, self.geometry_string('book_info_dialog_geometry')) diff --git a/src/calibre/gui2/dialogs/show_category_note.py b/src/calibre/gui2/dialogs/show_category_note.py index c152da008b..20e4f79860 100644 --- a/src/calibre/gui2/dialogs/show_category_note.py +++ b/src/calibre/gui2/dialogs/show_category_note.py @@ -129,6 +129,7 @@ class ShowNoteDialog(Dialog): if gui is not None: gui.do_field_item_value_changed() self.refresh() + self.setFocus(Qt.FocusReason.OtherFocusReason) def find_books(self): q = self.item_val.replace('"', r'\"')