E-book viewer: Fix a regression that broke the "show book in main calibre program" link. Fixes #2110117 [link in e-viewer stopped working](https://bugs.launchpad.net/calibre/+bug/2110117)

This commit is contained in:
Kovid Goyal 2025-05-07 16:49:41 +05:30
parent d2363c0c0a
commit 9c42e1f7cc
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 4 deletions

View File

@ -1179,7 +1179,10 @@ class Application(QApplication):
shutdown_signal_received = pyqtSignal()
palette_changed = pyqtSignal()
def __init__(self, args=(), force_calibre_style=False, override_program_name=None, headless=False, color_prefs=gprefs, windows_app_uid=None):
def __init__(
self, args=(), force_calibre_style=False, override_program_name=None, headless=False, color_prefs=gprefs, windows_app_uid=None,
should_handle_calibre_urls=False
):
if not args:
args = sys.argv[:1]
args = [args[0]]
@ -1213,8 +1216,9 @@ class Application(QApplication):
QApplication.setDesktopFileName(override_program_name)
QApplication.setAttribute(Qt.ApplicationAttribute.AA_ShareOpenGLContexts, True) # needed for webengine
QApplication.__init__(self, args)
# See https://bugreports.qt.io/browse/QTBUG-134316
QDesktopServices.setUrlHandler('calibre', self.handle_calibre_url)
if should_handle_calibre_urls:
# See https://bugreports.qt.io/browse/QTBUG-134316
QDesktopServices.setUrlHandler('calibre', self.handle_calibre_url)
set_image_allocation_limit()
self.palette_manager.initialize()
icon_resource_manager.initialize()

View File

@ -115,7 +115,7 @@ def init_qt(args):
prefs.set('library_path', os.path.abspath(libpath))
prints('Using library at', prefs['library_path'])
override = 'calibre-gui' if islinux else None
app = Application(args, override_program_name=override, windows_app_uid=MAIN_APP_UID)
app = Application(args, override_program_name=override, windows_app_uid=MAIN_APP_UID, should_handle_calibre_urls=True)
app.file_event_hook = EventAccumulator()
try: